Passed
Push — dev ( d62152...d10d14 )
by Salim
03:23
created
src/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
  * @author      Salim Kanoun <[email protected]>
21 21
  */
22 22
 
23
-header( 'content-type: text/html; charset=utf-8' );
23
+header('content-type: text/html; charset=utf-8');
24 24
 require_once('vendor/autoload.php');
25 25
 require 'router.php';
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/models/Documentation.php 3 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -20,66 +20,66 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class Documentation {
22 22
     
23
-    public $documentId;
24
-    public $study;
25
-    public $documentName;
26
-    public $documentFileLocation;
27
-    public $documentVersion;
28
-    public $documentDate;
29
-    public $accessInvestigator;
30
-    public $accessController;
31
-    public $accessMonitor;
32
-    public $accessReviewer;
33
-    public $deleted;
23
+	public $documentId;
24
+	public $study;
25
+	public $documentName;
26
+	public $documentFileLocation;
27
+	public $documentVersion;
28
+	public $documentDate;
29
+	public $accessInvestigator;
30
+	public $accessController;
31
+	public $accessMonitor;
32
+	public $accessReviewer;
33
+	public $deleted;
34 34
     
35 35
     
36
-    public function __construct(PDO $linkpdo, int $idDocumentation){
36
+	public function __construct(PDO $linkpdo, int $idDocumentation){
37 37
     	
38
-    	$documentationQuery = $linkpdo->prepare("SELECT * FROM documentation WHERE id_documentation = :idDocumentation");
39
-    	$documentationQuery->execute(array('idDocumentation' => $idDocumentation));
40
-    	$documentation=$documentationQuery->fetch(PDO::FETCH_ASSOC);
38
+		$documentationQuery = $linkpdo->prepare("SELECT * FROM documentation WHERE id_documentation = :idDocumentation");
39
+		$documentationQuery->execute(array('idDocumentation' => $idDocumentation));
40
+		$documentation=$documentationQuery->fetch(PDO::FETCH_ASSOC);
41 41
     	
42
-        $this->documentId=$documentation['id_documentation'];
43
-        $this->study=$documentation['study'];
44
-        $this->documentName=$documentation['name'];
45
-        $this->documentVersion=$documentation['version'];
46
-        $this->documentDate=$documentation['document_date'];
47
-        $this->accessInvestigator=$documentation['investigator'];
48
-        $this->accessController=$documentation['controller'];
49
-        $this->accessMonitor=$documentation['monitor'];
50
-        $this->accessReviewer=$documentation['reviewer'];
51
-        $this->deleted=$documentation['deleted'];
42
+		$this->documentId=$documentation['id_documentation'];
43
+		$this->study=$documentation['study'];
44
+		$this->documentName=$documentation['name'];
45
+		$this->documentVersion=$documentation['version'];
46
+		$this->documentDate=$documentation['document_date'];
47
+		$this->accessInvestigator=$documentation['investigator'];
48
+		$this->accessController=$documentation['controller'];
49
+		$this->accessMonitor=$documentation['monitor'];
50
+		$this->accessReviewer=$documentation['reviewer'];
51
+		$this->deleted=$documentation['deleted'];
52 52
         
53
-        $this->documentFileLocation = ($_SERVER['DOCUMENT_ROOT']."/data/upload/documentation/".$this->study."/".$this->documentName);
54
-    }
53
+		$this->documentFileLocation = ($_SERVER['DOCUMENT_ROOT']."/data/upload/documentation/".$this->study."/".$this->documentName);
54
+	}
55 55
     
56
-    /**
57
-     * Return if the current documentation is allowed for a given role
58
-     * @param String $role
59
-     * @return boolean
60
-     */
56
+	/**
57
+	 * Return if the current documentation is allowed for a given role
58
+	 * @param String $role
59
+	 * @return boolean
60
+	 */
61 61
     
62
-    public function isDocumentationAllowedForRole(String $role){
63
-        if($role==User::INVESTIGATOR) return $this->accessInvestigator;
64
-        else if($role==User::CONTROLLER) return $this->accessController;
65
-        else if($role==User::MONITOR) return $this->accessMonitor;
66
-        else if($role==User::REVIEWER) return $this->accessReviewer;
67
-        else if($role==User::SUPERVISOR) return true;
68
-        else return false;
69
-    }
62
+	public function isDocumentationAllowedForRole(String $role){
63
+		if($role==User::INVESTIGATOR) return $this->accessInvestigator;
64
+		else if($role==User::CONTROLLER) return $this->accessController;
65
+		else if($role==User::MONITOR) return $this->accessMonitor;
66
+		else if($role==User::REVIEWER) return $this->accessReviewer;
67
+		else if($role==User::SUPERVISOR) return true;
68
+		else return false;
69
+	}
70 70
     
71
-    /**
72
-     * Update documentation table
73
-     * @param PDO $linkpdo
74
-     * @param int $idDocumentation
75
-     * @param bool $investigator
76
-     * @param bool $monitor
77
-     * @param bool $controller
78
-     * @param bool $reviewer
79
-     * @param bool $deleted
80
-     */
81
-    public static function updateDocumentation(PDO $linkpdo, int $idDocumentation, bool $investigator, bool $monitor, bool $controller, bool $reviewer, bool $deleted){
82
-        $update = $linkpdo->prepare('UPDATE documentation
71
+	/**
72
+	 * Update documentation table
73
+	 * @param PDO $linkpdo
74
+	 * @param int $idDocumentation
75
+	 * @param bool $investigator
76
+	 * @param bool $monitor
77
+	 * @param bool $controller
78
+	 * @param bool $reviewer
79
+	 * @param bool $deleted
80
+	 */
81
+	public static function updateDocumentation(PDO $linkpdo, int $idDocumentation, bool $investigator, bool $monitor, bool $controller, bool $reviewer, bool $deleted){
82
+		$update = $linkpdo->prepare('UPDATE documentation
83 83
                                     SET investigator = :investigator,
84 84
                                         controller = :controller,
85 85
                                         monitor = :monitor,
@@ -87,29 +87,29 @@  discard block
 block discarded – undo
87 87
                                         deleted=:deleted
88 88
 									WHERE id_documentation = :id');
89 89
         
90
-        $update->execute(array('investigator' => intval($investigator),
91
-            'controller' => intval($controller),
92
-            'monitor' => intval($monitor),
93
-            'reviewer' =>intval($reviewer),
94
-            'deleted'=>intval($deleted),
95
-            'id' => $idDocumentation ));
96
-    }
90
+		$update->execute(array('investigator' => intval($investigator),
91
+			'controller' => intval($controller),
92
+			'monitor' => intval($monitor),
93
+			'reviewer' =>intval($reviewer),
94
+			'deleted'=>intval($deleted),
95
+			'id' => $idDocumentation ));
96
+	}
97 97
     
98
-    /**
99
-     * Create documentation entry in database
100
-     * @param PDO $linkpdo
101
-     * @param String $uploadedFilename
102
-     * @param String $study
103
-     * @param String $version
104
-     */
105
-    public static function insertDocumentation(PDO $linkpdo, String $uploadedFilename, String $study, String $version){
106
-        $insertion = $linkpdo->prepare('INSERT INTO documentation (name, document_date, study, version)
98
+	/**
99
+	 * Create documentation entry in database
100
+	 * @param PDO $linkpdo
101
+	 * @param String $uploadedFilename
102
+	 * @param String $study
103
+	 * @param String $version
104
+	 */
105
+	public static function insertDocumentation(PDO $linkpdo, String $uploadedFilename, String $study, String $version){
106
+		$insertion = $linkpdo->prepare('INSERT INTO documentation (name, document_date, study, version)
107 107
 																			VALUES (:name, :doc_date, :study, :version)');
108
-        $insertion->execute(array(
109
-            'name' => $uploadedFilename,
110
-            'doc_date' => date("Y-m-d"),
111
-            'study' => $study,
112
-            'version'=>$version
113
-        ));
114
-    }
108
+		$insertion->execute(array(
109
+			'name' => $uploadedFilename,
110
+			'doc_date' => date("Y-m-d"),
111
+			'study' => $study,
112
+			'version'=>$version
113
+		));
114
+	}
115 115
 }
116 116
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
     public $deleted;
34 34
     
35 35
     
36
-    public function __construct(PDO $linkpdo, int $idDocumentation){
36
+    public function __construct(PDO $linkpdo, int $idDocumentation) {
37 37
     	
38
-    	$documentationQuery = $linkpdo->prepare("SELECT * FROM documentation WHERE id_documentation = :idDocumentation");
38
+    	$documentationQuery=$linkpdo->prepare("SELECT * FROM documentation WHERE id_documentation = :idDocumentation");
39 39
     	$documentationQuery->execute(array('idDocumentation' => $idDocumentation));
40 40
     	$documentation=$documentationQuery->fetch(PDO::FETCH_ASSOC);
41 41
     	
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $this->accessReviewer=$documentation['reviewer'];
51 51
         $this->deleted=$documentation['deleted'];
52 52
         
53
-        $this->documentFileLocation = ($_SERVER['DOCUMENT_ROOT']."/data/upload/documentation/".$this->study."/".$this->documentName);
53
+        $this->documentFileLocation=($_SERVER['DOCUMENT_ROOT']."/data/upload/documentation/".$this->study."/".$this->documentName);
54 54
     }
55 55
     
56 56
     /**
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
      * @return boolean
60 60
      */
61 61
     
62
-    public function isDocumentationAllowedForRole(String $role){
63
-        if($role==User::INVESTIGATOR) return $this->accessInvestigator;
64
-        else if($role==User::CONTROLLER) return $this->accessController;
65
-        else if($role==User::MONITOR) return $this->accessMonitor;
66
-        else if($role==User::REVIEWER) return $this->accessReviewer;
67
-        else if($role==User::SUPERVISOR) return true;
62
+    public function isDocumentationAllowedForRole(String $role) {
63
+        if ($role == User::INVESTIGATOR) return $this->accessInvestigator;
64
+        else if ($role == User::CONTROLLER) return $this->accessController;
65
+        else if ($role == User::MONITOR) return $this->accessMonitor;
66
+        else if ($role == User::REVIEWER) return $this->accessReviewer;
67
+        else if ($role == User::SUPERVISOR) return true;
68 68
         else return false;
69 69
     }
70 70
     
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
      * @param bool $reviewer
79 79
      * @param bool $deleted
80 80
      */
81
-    public static function updateDocumentation(PDO $linkpdo, int $idDocumentation, bool $investigator, bool $monitor, bool $controller, bool $reviewer, bool $deleted){
82
-        $update = $linkpdo->prepare('UPDATE documentation
81
+    public static function updateDocumentation(PDO $linkpdo, int $idDocumentation, bool $investigator, bool $monitor, bool $controller, bool $reviewer, bool $deleted) {
82
+        $update=$linkpdo->prepare('UPDATE documentation
83 83
                                     SET investigator = :investigator,
84 84
                                         controller = :controller,
85 85
                                         monitor = :monitor,
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             'monitor' => intval($monitor),
93 93
             'reviewer' =>intval($reviewer),
94 94
             'deleted'=>intval($deleted),
95
-            'id' => $idDocumentation ));
95
+            'id' => $idDocumentation));
96 96
     }
97 97
     
98 98
     /**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      * @param String $study
103 103
      * @param String $version
104 104
      */
105
-    public static function insertDocumentation(PDO $linkpdo, String $uploadedFilename, String $study, String $version){
106
-        $insertion = $linkpdo->prepare('INSERT INTO documentation (name, document_date, study, version)
105
+    public static function insertDocumentation(PDO $linkpdo, String $uploadedFilename, String $study, String $version) {
106
+        $insertion=$linkpdo->prepare('INSERT INTO documentation (name, document_date, study, version)
107 107
 																			VALUES (:name, :doc_date, :study, :version)');
108 108
         $insertion->execute(array(
109 109
             'name' => $uploadedFilename,
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,12 +60,19 @@
 block discarded – undo
60 60
      */
61 61
     
62 62
     public function isDocumentationAllowedForRole(String $role){
63
-        if($role==User::INVESTIGATOR) return $this->accessInvestigator;
64
-        else if($role==User::CONTROLLER) return $this->accessController;
65
-        else if($role==User::MONITOR) return $this->accessMonitor;
66
-        else if($role==User::REVIEWER) return $this->accessReviewer;
67
-        else if($role==User::SUPERVISOR) return true;
68
-        else return false;
63
+        if($role==User::INVESTIGATOR) {
64
+        	return $this->accessInvestigator;
65
+        } else if($role==User::CONTROLLER) {
66
+        	return $this->accessController;
67
+        } else if($role==User::MONITOR) {
68
+        	return $this->accessMonitor;
69
+        } else if($role==User::REVIEWER) {
70
+        	return $this->accessReviewer;
71
+        } else if($role==User::SUPERVISOR) {
72
+        	return true;
73
+        } else {
74
+        	return false;
75
+        }
69 76
     }
70 77
     
71 78
     /**
Please login to merge, or discard this patch.
src/models/TagAnon.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@
 block discarded – undo
18 18
  */
19 19
 class TagAnon {
20 20
     
21
-    const KEEP=0;
22
-    const REPLACE=1;
23
-    const CLEAR=2;
21
+	const KEEP=0;
22
+	const REPLACE=1;
23
+	const CLEAR=2;
24 24
     
25
-    public $tag;
26
-    public $choice;
27
-    public $newValue;
25
+	public $tag;
26
+	public $choice;
27
+	public $newValue;
28 28
     
29
-    public function __construct($tag, $choice, $newValue=null){
30
-        $this->tag=$tag;
31
-        $this->choice=$choice;
32
-        $this->newValue=$newValue;
33
-    }
29
+	public function __construct($tag, $choice, $newValue=null){
30
+		$this->tag=$tag;
31
+		$this->choice=$choice;
32
+		$this->newValue=$newValue;
33
+	}
34 34
     
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
     public $choice;
27 27
     public $newValue;
28 28
     
29
-    public function __construct($tag, $choice, $newValue=null){
29
+    public function __construct($tag, $choice, $newValue=null) {
30 30
         $this->tag=$tag;
31 31
         $this->choice=$choice;
32 32
         $this->newValue=$newValue;
Please login to merge, or discard this patch.
src/models/Center.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct(PDO $linkpdo, $code){
34 34
 	    
35
-	    $centerQuery = $linkpdo->prepare('SELECT * FROM centers WHERE code=:code');
36
-	    $centerQuery->execute(array('code'=>$code));
37
-	    $center=$centerQuery->fetch(PDO::FETCH_ASSOC);
35
+		$centerQuery = $linkpdo->prepare('SELECT * FROM centers WHERE code=:code');
36
+		$centerQuery->execute(array('code'=>$code));
37
+		$center=$centerQuery->fetch(PDO::FETCH_ASSOC);
38 38
 	    
39
-	    if(empty($center)){
40
-	        throw new Exception("Non Existing Center");
41
-	    }
42
-	    $this->linkpdo=$linkpdo;
43
-	    $this->name=$center['name'];
44
-	    $this->code=$center['code'];
45
-	    $this->countryCode=$center['country_code'];
46
-	    $this->countryName=Global_Data::getCountryName($linkpdo, $this->countryCode);
39
+		if(empty($center)){
40
+			throw new Exception("Non Existing Center");
41
+		}
42
+		$this->linkpdo=$linkpdo;
43
+		$this->name=$center['name'];
44
+		$this->code=$center['code'];
45
+		$this->countryCode=$center['country_code'];
46
+		$this->countryName=Global_Data::getCountryName($linkpdo, $this->countryCode);
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	 * @param string $countryCode
53 53
 	 */
54 54
 	public function updateCenter(string $name, string $countryCode){
55
-	    $updatePatient = $this->linkpdo->prepare("UPDATE centers
55
+		$updatePatient = $this->linkpdo->prepare("UPDATE centers
56 56
                                             SET name = :centerName,
57 57
                                             country_code = :countryCode
58 58
                                             WHERE code = :code");
59 59
 	    
60
-	    $updatePatient->execute(array('centerName'=>$name,
61
-	        'countryCode'=>$countryCode,
62
-	        'code'=>$this->code));
60
+		$updatePatient->execute(array('centerName'=>$name,
61
+			'countryCode'=>$countryCode,
62
+			'code'=>$this->code));
63 63
 	    
64 64
 	}
65 65
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$insertion->execute(array(
108 108
 				'name' => $name,
109 109
 				'code' => $code,
110
-		        'countryCode' =>$countryCode
110
+				'countryCode' =>$countryCode
111 111
 		));
112 112
 	}
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * Center management in the plateform
18 18
  */
19 19
 
20
-Class Center{
20
+Class Center {
21 21
 	public $name;
22 22
 	public $code;
23 23
 	public $countryCode;
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 	 * @param $code
31 31
 	 * @throws Exception
32 32
 	 */
33
-	public function __construct(PDO $linkpdo, $code){
33
+	public function __construct(PDO $linkpdo, $code) {
34 34
 	    
35
-	    $centerQuery = $linkpdo->prepare('SELECT * FROM centers WHERE code=:code');
35
+	    $centerQuery=$linkpdo->prepare('SELECT * FROM centers WHERE code=:code');
36 36
 	    $centerQuery->execute(array('code'=>$code));
37 37
 	    $center=$centerQuery->fetch(PDO::FETCH_ASSOC);
38 38
 	    
39
-	    if(empty($center)){
39
+	    if (empty($center)) {
40 40
 	        throw new Exception("Non Existing Center");
41 41
 	    }
42 42
 	    $this->linkpdo=$linkpdo;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * @param string $name
52 52
 	 * @param string $countryCode
53 53
 	 */
54
-	public function updateCenter(string $name, string $countryCode){
55
-	    $updatePatient = $this->linkpdo->prepare("UPDATE centers
54
+	public function updateCenter(string $name, string $countryCode) {
55
+	    $updatePatient=$this->linkpdo->prepare("UPDATE centers
56 56
                                             SET name = :centerName,
57 57
                                             country_code = :countryCode
58 58
                                             WHERE code = :code");
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param $center
70 70
 	 * @return User[]
71 71
 	 */
72
-	public static function getUsersAffiliatedToCenter(PDO $linkpdo, $center){
72
+	public static function getUsersAffiliatedToCenter(PDO $linkpdo, $center) {
73 73
 		
74 74
 		//Select All users that has a matching center
75 75
 		$queryUsersEmail=$linkpdo->prepare('
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$users=$queryUsersEmail->fetchAll(PDO::FETCH_COLUMN);
88 88
 		
89 89
 		$usersObjects=[];
90
-		foreach ($users as $user){
90
+		foreach ($users as $user) {
91 91
 			$usersObjects[]=new User($user, $linkpdo);
92 92
 			
93 93
 		}
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param $name
103 103
 	 * @param string $countryCode
104 104
 	 */
105
-	public static function addCenter(PDO $linkpdo, $code, String $name, String $countryCode){
106
-		$insertion = $linkpdo->prepare('INSERT INTO centers (code, name, country_code) VALUES (:code, :name, :countryCode)' );
105
+	public static function addCenter(PDO $linkpdo, $code, String $name, String $countryCode) {
106
+		$insertion=$linkpdo->prepare('INSERT INTO centers (code, name, country_code) VALUES (:code, :name, :countryCode)');
107 107
 		$insertion->execute(array(
108 108
 				'name' => $name,
109 109
 				'code' => $code,
Please login to merge, or discard this patch.
src/models/Patient.php 3 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -19,99 +19,99 @@  discard block
 block discarded – undo
19 19
 
20 20
 class Patient{
21 21
     
22
-    public $patient;
23
-    private $linkpdo;
24
-    public $patientCode;
25
-    public $patientFirstName;
26
-    public $patientLastName;
27
-    public $patientGender;
28
-    public $patientBirthDateUS;
29
-    public $patientBirthDate;
30
-    public $patientRegistrationDate;
31
-    public $patientInvestigatorName;
32
-    public $patientCenter;
33
-    public $patientStudy;
34
-    public $patientWithdraw;
35
-    public $patientWithdrawReason;
36
-    public $patientWithdrawDate;
37
-    public $patientWithdrawDateString;
38
-
39
-    const PATIENT_WITHDRAW="withdraw";
22
+	public $patient;
23
+	private $linkpdo;
24
+	public $patientCode;
25
+	public $patientFirstName;
26
+	public $patientLastName;
27
+	public $patientGender;
28
+	public $patientBirthDateUS;
29
+	public $patientBirthDate;
30
+	public $patientRegistrationDate;
31
+	public $patientInvestigatorName;
32
+	public $patientCenter;
33
+	public $patientStudy;
34
+	public $patientWithdraw;
35
+	public $patientWithdrawReason;
36
+	public $patientWithdrawDate;
37
+	public $patientWithdrawDateString;
38
+
39
+	const PATIENT_WITHDRAW="withdraw";
40 40
     
41
-    function __construct($patientCode, PDO $linkpdo) {
42
-        $this->patient=$patientCode;
43
-        $this->linkpdo= $linkpdo;
41
+	function __construct($patientCode, PDO $linkpdo) {
42
+		$this->patient=$patientCode;
43
+		$this->linkpdo= $linkpdo;
44 44
         
45
-        $queryPatientsData = $this->linkpdo->prepare('SELECT * FROM patients WHERE code = :patient');
46
-        $queryPatientsData->execute(array('patient' => $this->patient));
47
-        $dataPatient = $queryPatientsData->fetch(PDO::FETCH_ASSOC);
45
+		$queryPatientsData = $this->linkpdo->prepare('SELECT * FROM patients WHERE code = :patient');
46
+		$queryPatientsData->execute(array('patient' => $this->patient));
47
+		$dataPatient = $queryPatientsData->fetch(PDO::FETCH_ASSOC);
48 48
         
49
-        if(empty($dataPatient)){
50
-            throw new Exception("Non Existing Patient");
51
-        }
49
+		if(empty($dataPatient)){
50
+			throw new Exception("Non Existing Patient");
51
+		}
52 52
         
53
-        $this->patientCode=$dataPatient['code'];
54
-        $this->patientFirstName=$dataPatient['first_name'];
55
-        $this->patientLastName=$dataPatient['last_name'];
56
-        $this->patientGender=$dataPatient['gender'];
57
-        $this->patientBirthDateUS=sprintf("%02d", $dataPatient['birth_month']).'-'.sprintf("%02d", $dataPatient['birth_day']).'-'.$dataPatient['birth_year'];
58
-        $this->patientBirthDate=sprintf("%02d", $dataPatient['birth_year']).'-'.sprintf("%02d", $dataPatient['birth_month']).'-'.$dataPatient['birth_day'];
59
-        $this->patientRegistrationDate=$dataPatient['registration_date'];
60
-        $this->patientInvestigatorName=$dataPatient['investigator_name'];
61
-        $this->patientCenter=$dataPatient['center'];
62
-        $this->patientStudy=$dataPatient['study'];
63
-        $this->patientWithdraw=$dataPatient['withdraw'];
64
-        $this->patientWithdrawReason=$dataPatient['withdraw_reason'];
65
-        $this->patientWithdrawDate=new DateTimeImmutable($dataPatient['withdraw_date']);
66
-        $this->patientWithdrawDateString=$dataPatient['withdraw_date'];
53
+		$this->patientCode=$dataPatient['code'];
54
+		$this->patientFirstName=$dataPatient['first_name'];
55
+		$this->patientLastName=$dataPatient['last_name'];
56
+		$this->patientGender=$dataPatient['gender'];
57
+		$this->patientBirthDateUS=sprintf("%02d", $dataPatient['birth_month']).'-'.sprintf("%02d", $dataPatient['birth_day']).'-'.$dataPatient['birth_year'];
58
+		$this->patientBirthDate=sprintf("%02d", $dataPatient['birth_year']).'-'.sprintf("%02d", $dataPatient['birth_month']).'-'.$dataPatient['birth_day'];
59
+		$this->patientRegistrationDate=$dataPatient['registration_date'];
60
+		$this->patientInvestigatorName=$dataPatient['investigator_name'];
61
+		$this->patientCenter=$dataPatient['center'];
62
+		$this->patientStudy=$dataPatient['study'];
63
+		$this->patientWithdraw=$dataPatient['withdraw'];
64
+		$this->patientWithdrawReason=$dataPatient['withdraw_reason'];
65
+		$this->patientWithdrawDate=new DateTimeImmutable($dataPatient['withdraw_date']);
66
+		$this->patientWithdrawDateString=$dataPatient['withdraw_date'];
67 67
         
68
-    }
68
+	}
69 69
 
70
-    public function getImmutableRegistrationDate() : DateTimeImmutable {
71
-        return new DateTimeImmutable($this->patientRegistrationDate);
72
-    }
70
+	public function getImmutableRegistrationDate() : DateTimeImmutable {
71
+		return new DateTimeImmutable($this->patientRegistrationDate);
72
+	}
73 73
     
74
-    /**
75
-     * get Patient's Center Object
76
-     * @return Center
77
-     */
78
-    public function getPatientCenter() : Center {
79
-        $centerObject=new Center($this->linkpdo, $this->patientCenter);
80
-        return $centerObject;
81
-    }
74
+	/**
75
+	 * get Patient's Center Object
76
+	 * @return Center
77
+	 */
78
+	public function getPatientCenter() : Center {
79
+		$centerObject=new Center($this->linkpdo, $this->patientCenter);
80
+		return $centerObject;
81
+	}
82 82
     
83
-    /**
84
-     * Update withdraw status
85
-     * @param bool $withdraw
86
-     * @param string $withdrawDate
87
-     * @param string $withdrawReason
88
-     */
89
-    public function changeWithdrawStatus(bool $withdraw, ?string $withdrawDate, ?string $withdrawReason){
83
+	/**
84
+	 * Update withdraw status
85
+	 * @param bool $withdraw
86
+	 * @param string $withdrawDate
87
+	 * @param string $withdrawReason
88
+	 */
89
+	public function changeWithdrawStatus(bool $withdraw, ?string $withdrawDate, ?string $withdrawReason){
90 90
         
91
-        $insertion = $this->linkpdo->prepare('UPDATE patients
91
+		$insertion = $this->linkpdo->prepare('UPDATE patients
92 92
                                             SET withdraw = :withdraw,
93 93
                                             withdraw_date = :withdraw_date,
94 94
                                             withdraw_reason = :withdraw_reason
95 95
                                             WHERE patients.code = :patient');
96 96
         
97
-        $insertion->execute(array('withdraw'=>intval($withdraw),
98
-            'withdraw_date' => $withdrawDate,
99
-            'withdraw_reason' => $withdrawReason,
100
-            'patient' => $this->patient));
97
+		$insertion->execute(array('withdraw'=>intval($withdraw),
98
+			'withdraw_date' => $withdrawDate,
99
+			'withdraw_reason' => $withdrawReason,
100
+			'patient' => $this->patient));
101 101
         
102
-    }
102
+	}
103 103
     
104
-    /**
105
-     * Update patient data
106
-     * @param $initials
107
-     * @param $gender
108
-     * @param $birthDate
109
-     * @param $registrationDate
110
-     * @param $investigator
111
-     * @param $centerCode
112
-     */
113
-    public function editPatientDetails($initials, $gender, $birthDate, $registrationDate, $investigator, $centerCode){
114
-            $insertion = $this->linkpdo->prepare("UPDATE patients
104
+	/**
105
+	 * Update patient data
106
+	 * @param $initials
107
+	 * @param $gender
108
+	 * @param $birthDate
109
+	 * @param $registrationDate
110
+	 * @param $investigator
111
+	 * @param $centerCode
112
+	 */
113
+	public function editPatientDetails($initials, $gender, $birthDate, $registrationDate, $investigator, $centerCode){
114
+			$insertion = $this->linkpdo->prepare("UPDATE patients
115 115
                                             SET first_name = :firstName,
116 116
                                             last_name = :lastName,
117 117
                                             gender = :gender,
@@ -123,131 +123,131 @@  discard block
 block discarded – undo
123 123
                                             center=:centerCode
124 124
                                             WHERE patients.code = :patient");
125 125
             
126
-            $insertion->execute(array('firstName'=>$initials[1],
127
-                'lastName'=>$initials[0],
128
-                'gender'=>strtoupper($gender[0]),
129
-                'year'=>substr($birthDate, 0, 4),
130
-                'month'=>substr($birthDate, 5, 2),
131
-                'day'=>substr($birthDate, 8, 2),
132
-                'registrationDate' => $registrationDate,
133
-                'investigator' => $investigator,
134
-                'centerCode'=>$centerCode,
135
-                'patient' => $this->patient));
126
+			$insertion->execute(array('firstName'=>$initials[1],
127
+				'lastName'=>$initials[0],
128
+				'gender'=>strtoupper($gender[0]),
129
+				'year'=>substr($birthDate, 0, 4),
130
+				'month'=>substr($birthDate, 5, 2),
131
+				'day'=>substr($birthDate, 8, 2),
132
+				'registrationDate' => $registrationDate,
133
+				'investigator' => $investigator,
134
+				'centerCode'=>$centerCode,
135
+				'patient' => $this->patient));
136 136
        
137 137
         
138
-    }
139
-
140
-    /**
141
-     * Return visit Manage to manage patient's visit status
142
-     */
143
-    public function getPatientVisitManager(Visit_Group $visitGroupObject) {
144
-        //Look if specific patient visit manager exists for this study
145
-        $specificObjectFile=$_SERVER["DOCUMENT_ROOT"].'/data/form/'.$this->patientStudy.'/Poo/'.$this->patientStudy."_Patient_Visit_Manager.php";
138
+	}
139
+
140
+	/**
141
+	 * Return visit Manage to manage patient's visit status
142
+	 */
143
+	public function getPatientVisitManager(Visit_Group $visitGroupObject) {
144
+		//Look if specific patient visit manager exists for this study
145
+		$specificObjectFile=$_SERVER["DOCUMENT_ROOT"].'/data/form/'.$this->patientStudy.'/Poo/'.$this->patientStudy."_Patient_Visit_Manager.php";
146 146
             
147
-        if(is_file($specificObjectFile)){
148
-            require_once($specificObjectFile);
149
-            $objectName=$this->patientStudy."_Patient_Visit_Manager";
150
-            return new $objectName($this, $visitGroupObject, $this->linkpdo);
151
-        }else{
152
-            return new Patient_Visit_Manager($this, $visitGroupObject, $this->linkpdo);
153
-        }
147
+		if(is_file($specificObjectFile)){
148
+			require_once($specificObjectFile);
149
+			$objectName=$this->patientStudy."_Patient_Visit_Manager";
150
+			return new $objectName($this, $visitGroupObject, $this->linkpdo);
151
+		}else{
152
+			return new Patient_Visit_Manager($this, $visitGroupObject, $this->linkpdo);
153
+		}
154 154
 
155
-    }
155
+	}
156 156
 
157
-    private function getAllPossibleVisitGroup() : Array { 
157
+	private function getAllPossibleVisitGroup() : Array { 
158 158
 
159
-        $patientStudy=$this->getPatientStudy();
160
-        $possibleStudyGroups=$patientStudy->getAllPossibleVisitGroups();
159
+		$patientStudy=$this->getPatientStudy();
160
+		$possibleStudyGroups=$patientStudy->getAllPossibleVisitGroups();
161 161
 
162
-        return $possibleStudyGroups;
162
+		return $possibleStudyGroups;
163 163
 
164
-    }
164
+	}
165 165
 
166
-    /**
167
-     * Return visits created for this patient without group filter
168
-     */
169
-    public function getAllCreatedPatientsVisits(bool $deletedVisits = false) : Array
170
-    {
171
-        $possibleStudyGroups=$this->getAllPossibleVisitGroup();
166
+	/**
167
+	 * Return visits created for this patient without group filter
168
+	 */
169
+	public function getAllCreatedPatientsVisits(bool $deletedVisits = false) : Array
170
+	{
171
+		$possibleStudyGroups=$this->getAllPossibleVisitGroup();
172 172
 
173
-        $visitsObjectArray = [];
173
+		$visitsObjectArray = [];
174 174
 
175
-        foreach($possibleStudyGroups as $studyGroup){
176
-            $createdVisits=$this->getPatientVisitManager($studyGroup)->getCreatedPatientsVisits($deletedVisits);
177
-            array_push($visitsObjectArray, ...$createdVisits);
178
-        }
175
+		foreach($possibleStudyGroups as $studyGroup){
176
+			$createdVisits=$this->getPatientVisitManager($studyGroup)->getCreatedPatientsVisits($deletedVisits);
177
+			array_push($visitsObjectArray, ...$createdVisits);
178
+		}
179 179
 
180
-        return $visitsObjectArray;
181
-    }
180
+		return $visitsObjectArray;
181
+	}
182 182
 
183 183
 
184
-     /**
185
-     * Return visits uploaded for this patient without group filter
186
-     */
187
-    public function getAllQcDonePatientsVisits(bool $deletedVisits = false) : Array
188
-    {
189
-        $possibleStudyGroups=$this->getAllPossibleVisitGroup();
184
+	 /**
185
+	  * Return visits uploaded for this patient without group filter
186
+	  */
187
+	public function getAllQcDonePatientsVisits(bool $deletedVisits = false) : Array
188
+	{
189
+		$possibleStudyGroups=$this->getAllPossibleVisitGroup();
190 190
 
191
-        $visitsObjectArray = [];
191
+		$visitsObjectArray = [];
192 192
 
193
-        foreach($possibleStudyGroups as $studyGroup){
194
-            $createdVisits=$this->getPatientVisitManager($studyGroup)->getQcDonePatientsVisits($deletedVisits);
195
-            array_push($visitsObjectArray, ...$createdVisits);
196
-        }
193
+		foreach($possibleStudyGroups as $studyGroup){
194
+			$createdVisits=$this->getPatientVisitManager($studyGroup)->getQcDonePatientsVisits($deletedVisits);
195
+			array_push($visitsObjectArray, ...$createdVisits);
196
+		}
197 197
 
198
-        return $visitsObjectArray;
199
-    }
198
+		return $visitsObjectArray;
199
+	}
200 200
 
201
-    public function getAllVisitToCreate() : array {
201
+	public function getAllVisitToCreate() : array {
202 202
 
203
-        $possiblevisitsGroups=$this->getAllPossibleVisitGroup();
203
+		$possiblevisitsGroups=$this->getAllPossibleVisitGroup();
204 204
 
205
-        $visitsObjectArray = [];
205
+		$visitsObjectArray = [];
206 206
 
207
-        foreach($possiblevisitsGroups as $visitGroup){
208
-            try{
209
-                $availableVisits=$this->getPatientVisitManager($visitGroup)->getAvailableVisitsToCreate();
210
-            }catch (Exception $e){
211
-                $availableVisits=array($e->getMessage());
212
-            }
207
+		foreach($possiblevisitsGroups as $visitGroup){
208
+			try{
209
+				$availableVisits=$this->getPatientVisitManager($visitGroup)->getAvailableVisitsToCreate();
210
+			}catch (Exception $e){
211
+				$availableVisits=array($e->getMessage());
212
+			}
213 213
 
214
-            $visitsObjectArray [$visitGroup->groupModality]['visitsName'] = $availableVisits;
215
-            $visitsObjectArray [$visitGroup->groupModality]['groupId'] = $visitGroup->groupId;
216
-        }
214
+			$visitsObjectArray [$visitGroup->groupModality]['visitsName'] = $availableVisits;
215
+			$visitsObjectArray [$visitGroup->groupModality]['groupId'] = $visitGroup->groupId;
216
+		}
217 217
 
218
-        return $visitsObjectArray;
218
+		return $visitsObjectArray;
219 219
 
220
-    }
220
+	}
221 221
 
222
-    public function isMissingVisit(){
222
+	public function isMissingVisit(){
223 223
 
224
-        $modalitiesMissingVisits=$this->getMissingVisitModalities();
224
+		$modalitiesMissingVisits=$this->getMissingVisitModalities();
225 225
 
226
-        $isMissingSomeVisits= ( sizeof($modalitiesMissingVisits) > 0 ) ;
226
+		$isMissingSomeVisits= ( sizeof($modalitiesMissingVisits) > 0 ) ;
227 227
 
228
-        return $isMissingSomeVisits ; 
228
+		return $isMissingSomeVisits ; 
229 229
 
230
-    }
230
+	}
231 231
 
232
-    public function getMissingVisitModalities(){
232
+	public function getMissingVisitModalities(){
233 233
 
234
-        $possiblevisitsGroups=$this->getAllPossibleVisitGroup();
234
+		$possiblevisitsGroups=$this->getAllPossibleVisitGroup();
235 235
 
236
-        $visitsMissingGroupsArray = [];
236
+		$visitsMissingGroupsArray = [];
237 237
 
238
-        foreach($possiblevisitsGroups as $visitGroup){
239
-            $missingVisit=$this->getPatientVisitManager($visitGroup)->isMissingVisit();
240
-            if($missingVisit){
241
-                $visitsMissingGroupsArray[]=$visitGroup->groupModality;
242
-            }
243
-        }
238
+		foreach($possiblevisitsGroups as $visitGroup){
239
+			$missingVisit=$this->getPatientVisitManager($visitGroup)->isMissingVisit();
240
+			if($missingVisit){
241
+				$visitsMissingGroupsArray[]=$visitGroup->groupModality;
242
+			}
243
+		}
244 244
 
245
-        return $visitsMissingGroupsArray;
245
+		return $visitsMissingGroupsArray;
246 246
 
247
-    }
247
+	}
248 248
 
249
-    public function getPatientStudy() : Study {
250
-        return new Study($this->patientStudy, $this->linkpdo);
251
-    }
249
+	public function getPatientStudy() : Study {
250
+		return new Study($this->patientStudy, $this->linkpdo);
251
+	}
252 252
       
253 253
 }
254 254
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * Access Patient data
18 18
  */
19 19
 
20
-class Patient{
20
+class Patient {
21 21
     
22 22
     public $patient;
23 23
     private $linkpdo;
@@ -40,13 +40,13 @@  discard block
 block discarded – undo
40 40
     
41 41
     function __construct($patientCode, PDO $linkpdo) {
42 42
         $this->patient=$patientCode;
43
-        $this->linkpdo= $linkpdo;
43
+        $this->linkpdo=$linkpdo;
44 44
         
45
-        $queryPatientsData = $this->linkpdo->prepare('SELECT * FROM patients WHERE code = :patient');
45
+        $queryPatientsData=$this->linkpdo->prepare('SELECT * FROM patients WHERE code = :patient');
46 46
         $queryPatientsData->execute(array('patient' => $this->patient));
47
-        $dataPatient = $queryPatientsData->fetch(PDO::FETCH_ASSOC);
47
+        $dataPatient=$queryPatientsData->fetch(PDO::FETCH_ASSOC);
48 48
         
49
-        if(empty($dataPatient)){
49
+        if (empty($dataPatient)) {
50 50
             throw new Exception("Non Existing Patient");
51 51
         }
52 52
         
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      * @param string $withdrawDate
87 87
      * @param string $withdrawReason
88 88
      */
89
-    public function changeWithdrawStatus(bool $withdraw, ?string $withdrawDate, ?string $withdrawReason){
89
+    public function changeWithdrawStatus(bool $withdraw, ?string $withdrawDate, ?string $withdrawReason) {
90 90
         
91
-        $insertion = $this->linkpdo->prepare('UPDATE patients
91
+        $insertion=$this->linkpdo->prepare('UPDATE patients
92 92
                                             SET withdraw = :withdraw,
93 93
                                             withdraw_date = :withdraw_date,
94 94
                                             withdraw_reason = :withdraw_reason
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
      * @param $investigator
111 111
      * @param $centerCode
112 112
      */
113
-    public function editPatientDetails($initials, $gender, $birthDate, $registrationDate, $investigator, $centerCode){
114
-            $insertion = $this->linkpdo->prepare("UPDATE patients
113
+    public function editPatientDetails($initials, $gender, $birthDate, $registrationDate, $investigator, $centerCode) {
114
+            $insertion=$this->linkpdo->prepare("UPDATE patients
115 115
                                             SET first_name = :firstName,
116 116
                                             last_name = :lastName,
117 117
                                             gender = :gender,
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
         //Look if specific patient visit manager exists for this study
145 145
         $specificObjectFile=$_SERVER["DOCUMENT_ROOT"].'/data/form/'.$this->patientStudy.'/Poo/'.$this->patientStudy."_Patient_Visit_Manager.php";
146 146
             
147
-        if(is_file($specificObjectFile)){
147
+        if (is_file($specificObjectFile)) {
148 148
             require_once($specificObjectFile);
149 149
             $objectName=$this->patientStudy."_Patient_Visit_Manager";
150 150
             return new $objectName($this, $visitGroupObject, $this->linkpdo);
151
-        }else{
151
+        }else {
152 152
             return new Patient_Visit_Manager($this, $visitGroupObject, $this->linkpdo);
153 153
         }
154 154
 
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
     /**
167 167
      * Return visits created for this patient without group filter
168 168
      */
169
-    public function getAllCreatedPatientsVisits(bool $deletedVisits = false) : Array
169
+    public function getAllCreatedPatientsVisits(bool $deletedVisits=false) : Array
170 170
     {
171 171
         $possibleStudyGroups=$this->getAllPossibleVisitGroup();
172 172
 
173
-        $visitsObjectArray = [];
173
+        $visitsObjectArray=[];
174 174
 
175
-        foreach($possibleStudyGroups as $studyGroup){
175
+        foreach ($possibleStudyGroups as $studyGroup) {
176 176
             $createdVisits=$this->getPatientVisitManager($studyGroup)->getCreatedPatientsVisits($deletedVisits);
177 177
             array_push($visitsObjectArray, ...$createdVisits);
178 178
         }
@@ -184,13 +184,13 @@  discard block
 block discarded – undo
184 184
      /**
185 185
      * Return visits uploaded for this patient without group filter
186 186
      */
187
-    public function getAllQcDonePatientsVisits(bool $deletedVisits = false) : Array
187
+    public function getAllQcDonePatientsVisits(bool $deletedVisits=false) : Array
188 188
     {
189 189
         $possibleStudyGroups=$this->getAllPossibleVisitGroup();
190 190
 
191
-        $visitsObjectArray = [];
191
+        $visitsObjectArray=[];
192 192
 
193
-        foreach($possibleStudyGroups as $studyGroup){
193
+        foreach ($possibleStudyGroups as $studyGroup) {
194 194
             $createdVisits=$this->getPatientVisitManager($studyGroup)->getQcDonePatientsVisits($deletedVisits);
195 195
             array_push($visitsObjectArray, ...$createdVisits);
196 196
         }
@@ -202,42 +202,42 @@  discard block
 block discarded – undo
202 202
 
203 203
         $possiblevisitsGroups=$this->getAllPossibleVisitGroup();
204 204
 
205
-        $visitsObjectArray = [];
205
+        $visitsObjectArray=[];
206 206
 
207
-        foreach($possiblevisitsGroups as $visitGroup){
208
-            try{
207
+        foreach ($possiblevisitsGroups as $visitGroup) {
208
+            try {
209 209
                 $availableVisits=$this->getPatientVisitManager($visitGroup)->getAvailableVisitsToCreate();
210
-            }catch (Exception $e){
210
+            }catch (Exception $e) {
211 211
                 $availableVisits=array($e->getMessage());
212 212
             }
213 213
 
214
-            $visitsObjectArray [$visitGroup->groupModality]['visitsName'] = $availableVisits;
215
-            $visitsObjectArray [$visitGroup->groupModality]['groupId'] = $visitGroup->groupId;
214
+            $visitsObjectArray [$visitGroup->groupModality]['visitsName']=$availableVisits;
215
+            $visitsObjectArray [$visitGroup->groupModality]['groupId']=$visitGroup->groupId;
216 216
         }
217 217
 
218 218
         return $visitsObjectArray;
219 219
 
220 220
     }
221 221
 
222
-    public function isMissingVisit(){
222
+    public function isMissingVisit() {
223 223
 
224 224
         $modalitiesMissingVisits=$this->getMissingVisitModalities();
225 225
 
226
-        $isMissingSomeVisits= ( sizeof($modalitiesMissingVisits) > 0 ) ;
226
+        $isMissingSomeVisits=(sizeof($modalitiesMissingVisits) > 0);
227 227
 
228
-        return $isMissingSomeVisits ; 
228
+        return $isMissingSomeVisits; 
229 229
 
230 230
     }
231 231
 
232
-    public function getMissingVisitModalities(){
232
+    public function getMissingVisitModalities() {
233 233
 
234 234
         $possiblevisitsGroups=$this->getAllPossibleVisitGroup();
235 235
 
236
-        $visitsMissingGroupsArray = [];
236
+        $visitsMissingGroupsArray=[];
237 237
 
238
-        foreach($possiblevisitsGroups as $visitGroup){
238
+        foreach ($possiblevisitsGroups as $visitGroup) {
239 239
             $missingVisit=$this->getPatientVisitManager($visitGroup)->isMissingVisit();
240
-            if($missingVisit){
240
+            if ($missingVisit) {
241 241
                 $visitsMissingGroupsArray[]=$visitGroup->groupModality;
242 242
             }
243 243
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             require_once($specificObjectFile);
149 149
             $objectName=$this->patientStudy."_Patient_Visit_Manager";
150 150
             return new $objectName($this, $visitGroupObject, $this->linkpdo);
151
-        }else{
151
+        } else{
152 152
             return new Patient_Visit_Manager($this, $visitGroupObject, $this->linkpdo);
153 153
         }
154 154
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         foreach($possiblevisitsGroups as $visitGroup){
208 208
             try{
209 209
                 $availableVisits=$this->getPatientVisitManager($visitGroup)->getAvailableVisitsToCreate();
210
-            }catch (Exception $e){
210
+            } catch (Exception $e){
211 211
                 $availableVisits=array($e->getMessage());
212 212
             }
213 213
 
Please login to merge, or discard this patch.
src/models/Orthanc_Patient.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	
33 33
 	
34 34
 	public function __construct($patientOrthancID, $url, $context){
35
-	    //Set orthanc address
36
-	    $this->url=$url;
37
-	    $this->context = $context;
38
-	    //Set current patient Orthanc ID
35
+		//Set orthanc address
36
+		$this->url=$url;
37
+		$this->context = $context;
38
+		//Set current patient Orthanc ID
39 39
 		$this->patientOrthancID=$patientOrthancID;
40 40
 	}
41 41
 	
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * Get and store the main tags of the patient level
44 44
 	 */
45 45
 	public function retrievePatientData(){
46
-	    $context  = stream_context_create($this->context);
47
-	    $json = file_get_contents($this->url.'/patients/'.$this->patientOrthancID, false, $context);
46
+		$context  = stream_context_create($this->context);
47
+		$json = file_get_contents($this->url.'/patients/'.$this->patientOrthancID, false, $context);
48 48
 		$patientJson=json_decode($json, true);
49 49
 		//Add needed informations in this object
50 50
 		$this->patientName=$patientJson['MainDicomTags']['PatientName'];
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * This class is not used anymore ...
20 20
  */
21 21
 
22
-class Orthanc_Patient{
22
+class Orthanc_Patient {
23 23
 	public $patientName;
24 24
 	public $patientID;
25 25
 	public $patientSex;
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	private $context;
32 32
 	
33 33
 	
34
-	public function __construct($patientOrthancID, $url, $context){
34
+	public function __construct($patientOrthancID, $url, $context) {
35 35
 	    //Set orthanc address
36 36
 	    $this->url=$url;
37
-	    $this->context = $context;
37
+	    $this->context=$context;
38 38
 	    //Set current patient Orthanc ID
39 39
 		$this->patientOrthancID=$patientOrthancID;
40 40
 	}
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 	/** 
43 43
 	 * Get and store the main tags of the patient level
44 44
 	 */
45
-	public function retrievePatientData(){
46
-	    $context  = stream_context_create($this->context);
47
-	    $json = file_get_contents($this->url.'/patients/'.$this->patientOrthancID, false, $context);
45
+	public function retrievePatientData() {
46
+	    $context=stream_context_create($this->context);
47
+	    $json=file_get_contents($this->url.'/patients/'.$this->patientOrthancID, false, $context);
48 48
 		$patientJson=json_decode($json, true);
49 49
 		//Add needed informations in this object
50 50
 		$this->patientName=$patientJson['MainDicomTags']['PatientName'];
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * Retrieve data from study level
60 60
 	 */
61
-	public function getStudiesData(){
62
-		foreach ($this->studiesOrthancID as $studyID){
61
+	public function getStudiesData() {
62
+		foreach ($this->studiesOrthancID as $studyID) {
63 63
 			//Create a study object of each study
64 64
 			$study=new Orthanc_Study($studyID, $this->url, $this->context);
65 65
 			//fetch the data of the study level
Please login to merge, or discard this patch.
src/models/Group_Visit_Manager.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,9 @@
 block discarded – undo
124 124
             $visitObject = new Visit($visitId, $this->linkpdo);
125 125
 
126 126
             if (!empty($username)) {
127
-                if ($visitObject->isAwaitingReviewForReviewerUser($username)) $visitObjectArray[] = $visitObject;
127
+                if ($visitObject->isAwaitingReviewForReviewerUser($username)) {
128
+                	$visitObjectArray[] = $visitObject;
129
+                }
128 130
             } else {
129 131
                 $visitObjectArray[] = $visitObject;
130 132
             }
Please login to merge, or discard this patch.
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -21,57 +21,57 @@  discard block
 block discarded – undo
21 21
 class Group_Visit_Manager
22 22
 {
23 23
 
24
-    private Study $studyObject;
25
-    private Visit_Group $visitGroupObject;
26
-    private PDO $linkpdo;
27
-
28
-
29
-    public function __construct(Study $studyObject, Visit_Group $visitGroupObject, PDO $linkpdo)
30
-    {
31
-        $this->linkpdo = $linkpdo;
32
-        $this->studyObject = $studyObject;
33
-        $this->visitGroupObject = $visitGroupObject;
34
-    }
35
-
36
-    public function getVisitGroupObject(): Visit_Group
37
-    {
38
-        return $this->visitGroupObject;
39
-    }
40
-
41
-    /**
42
-     * Return uploaded and non deleted visit Objects (visit Done and Upload status done)
43
-     */
44
-    public function getUploadedVisits(): array
45
-    {
46
-
47
-        $uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
24
+	private Study $studyObject;
25
+	private Visit_Group $visitGroupObject;
26
+	private PDO $linkpdo;
27
+
28
+
29
+	public function __construct(Study $studyObject, Visit_Group $visitGroupObject, PDO $linkpdo)
30
+	{
31
+		$this->linkpdo = $linkpdo;
32
+		$this->studyObject = $studyObject;
33
+		$this->visitGroupObject = $visitGroupObject;
34
+	}
35
+
36
+	public function getVisitGroupObject(): Visit_Group
37
+	{
38
+		return $this->visitGroupObject;
39
+	}
40
+
41
+	/**
42
+	 * Return uploaded and non deleted visit Objects (visit Done and Upload status done)
43
+	 */
44
+	public function getUploadedVisits(): array
45
+	{
46
+
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)
51 51
                                                                 WHERE deleted=0
52 52
                                                                     AND upload_status="Done" ');
53 53
 
54
-        $uploadedVisitQuery->execute(array(
55
-            'visitGroupId' => $this->visitGroupObject->groupId
56
-        ));
54
+		$uploadedVisitQuery->execute(array(
55
+			'visitGroupId' => $this->visitGroupObject->groupId
56
+		));
57 57
 
58
-        $uploadedVisitIds = $uploadedVisitQuery->fetchall(PDO::FETCH_COLUMN);
58
+		$uploadedVisitIds = $uploadedVisitQuery->fetchall(PDO::FETCH_COLUMN);
59 59
 
60
-        $visitObjectArray = [];
61
-        foreach ($uploadedVisitIds as $id_visit) {
62
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
63
-        }
60
+		$visitObjectArray = [];
61
+		foreach ($uploadedVisitIds as $id_visit) {
62
+			$visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
63
+		}
64 64
 
65
-        return $visitObjectArray;
66
-    }
65
+		return $visitObjectArray;
66
+	}
67 67
 
68
-    /**
69
-     * Get visits with a awaiting upload status (Visit Done but upload status not done)
70
-     */
71
-    public function getAwaitingUploadVisit(): array
72
-    {
68
+	/**
69
+	 * Get visits with a awaiting upload status (Visit Done but upload status not done)
70
+	 */
71
+	public function getAwaitingUploadVisit(): array
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)
@@ -79,32 +79,32 @@  discard block
 block discarded – undo
79 79
 														        AND upload_status = 'Not Done'
80 80
 														        AND status_done = 'Done' ");
81 81
 
82
-        $uploadedVisitQuery->execute(
83
-            array(
84
-                'visitGroupId' => $this->visitGroupObject->groupId
85
-            )
86
-        );
87
-        $uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
88
-
89
-        $visitObjectArray = [];
90
-        foreach ($uploadedVisitIds as $id_visit) {
91
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
92
-        }
93
-
94
-        return $visitObjectArray;
95
-    }
96
-
97
-    /**
98
-     * Get Visits awaiting review
99
-     * Optionally visit awaiting review can be specific to an username
100
-     * @param string $username
101
-     * @return Visit[]
102
-     */
103
-    public function getAwaitingReviewVisit(string $username = null): array
104
-    {
105
-
106
-        //Query visit to analyze visit awaiting a review
107
-        $idVisitsQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
82
+		$uploadedVisitQuery->execute(
83
+			array(
84
+				'visitGroupId' => $this->visitGroupObject->groupId
85
+			)
86
+		);
87
+		$uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
88
+
89
+		$visitObjectArray = [];
90
+		foreach ($uploadedVisitIds as $id_visit) {
91
+			$visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
92
+		}
93
+
94
+		return $visitObjectArray;
95
+	}
96
+
97
+	/**
98
+	 * Get Visits awaiting review
99
+	 * Optionally visit awaiting review can be specific to an username
100
+	 * @param string $username
101
+	 * @return Visit[]
102
+	 */
103
+	public function getAwaitingReviewVisit(string $username = null): array
104
+	{
105
+
106
+		//Query visit to analyze visit awaiting a review
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)
@@ -112,35 +112,35 @@  discard block
 block discarded – undo
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)) $visitObjectArray[] = $visitObject;
128
-            } else {
129
-                $visitObjectArray[] = $visitObject;
130
-            }
131
-        }
126
+			if (!empty($username)) {
127
+				if ($visitObject->isAwaitingReviewForReviewerUser($username)) $visitObjectArray[] = $visitObject;
128
+			} else {
129
+				$visitObjectArray[] = $visitObject;
130
+			}
131
+		}
132 132
 
133
-        return $visitObjectArray;
134
-    }
133
+		return $visitObjectArray;
134
+	}
135 135
 
136
-    /**
137
-     * For controller tree
138
-     * List all visits that awaiting QC Action (QC not done or waiting definitive conclusion)
139
-     */
140
-    public function getVisitForControllerAction(): array
141
-    {
136
+	/**
137
+	 * For controller tree
138
+	 * List all visits that awaiting QC Action (QC not done or waiting definitive conclusion)
139
+	 */
140
+	public function getVisitForControllerAction(): array
141
+	{
142 142
 
143
-        $visitsQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
143
+		$visitsQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
144 144
                                                     INNER JOIN visit_type ON 
145 145
                                                         (visit_type.id=visits.visit_type_id 
146 146
                                                         AND visit_type.group_id = :visitGroupId)
@@ -151,55 +151,55 @@  discard block
 block discarded – undo
151 151
                                                     AND (state_quality_control = "Not Done"
152 152
                                                         OR state_quality_control = "Wait Definitive Conclusion")
153 153
                                                     ORDER BY visit_type.visit_order');
154
-        $visitsQuery->execute(array(
155
-            'visitGroupId' => $this->visitGroupObject->groupId
156
-        ));
154
+		$visitsQuery->execute(array(
155
+			'visitGroupId' => $this->visitGroupObject->groupId
156
+		));
157 157
 
158
-        $visits = $visitsQuery->fetchAll(PDO::FETCH_COLUMN);
158
+		$visits = $visitsQuery->fetchAll(PDO::FETCH_COLUMN);
159 159
 
160
-        $visitObjectArray = [];
161
-        foreach ($visits as $visit) {
162
-            $visitObjectArray[] = new Visit($visit, $this->linkpdo);
163
-        }
160
+		$visitObjectArray = [];
161
+		foreach ($visits as $visit) {
162
+			$visitObjectArray[] = new Visit($visit, $this->linkpdo);
163
+		}
164 164
 
165
-        return $visitObjectArray;
166
-    }
165
+		return $visitObjectArray;
166
+	}
167 167
 
168
-    /**
169
-     * Return visits with a specific QC Status
170
-     */
171
-    public function getVisitWithQCStatus($qcStatus): array
172
-    {
168
+	/**
169
+	 * Return visits with a specific QC Status
170
+	 */
171
+	public function getVisitWithQCStatus($qcStatus): array
172
+	{
173 173
 
174
-        $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
174
+		$visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
175 175
                                                         INNER JOIN visit_type ON 
176 176
                                                             (visit_type.id=visits.visit_type_id 
177 177
                                                             AND visit_type.group_id = :visitGroupId)
178 178
                                                         WHERE deleted=0
179 179
                                                         AND state_quality_control=:qcStatus");
180 180
 
181
-        $visitQuery->execute(array(
182
-            'study' => $this->study,
183
-            'qcStatus' => $qcStatus,
184
-            'visitGroupId' => $this->visitGroupObject->groupId
185
-        ));
186
-        $visitIds = $visitQuery->fetchall(PDO::FETCH_COLUMN);
181
+		$visitQuery->execute(array(
182
+			'study' => $this->study,
183
+			'qcStatus' => $qcStatus,
184
+			'visitGroupId' => $this->visitGroupObject->groupId
185
+		));
186
+		$visitIds = $visitQuery->fetchall(PDO::FETCH_COLUMN);
187 187
 
188
-        $visitObjectArray = [];
189
-        foreach ($visitIds as $id_visit) {
190
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
191
-        }
188
+		$visitObjectArray = [];
189
+		foreach ($visitIds as $id_visit) {
190
+			$visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
191
+		}
192 192
 
193
-        return $visitObjectArray;
194
-    }
193
+		return $visitObjectArray;
194
+	}
195 195
 
196
-    /**
197
-     * Get Visits with image uploaded status but investigator form missing
198
-     */
199
-    public function getVisitsMissingInvestigatorForm(): array
200
-    {
196
+	/**
197
+	 * Get Visits with image uploaded status but investigator form missing
198
+	 */
199
+	public function getVisitsMissingInvestigatorForm(): array
200
+	{
201 201
 
202
-        $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
202
+		$visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
203 203
                                                             INNER JOIN visit_type ON 
204 204
                                                                 (visit_type.id=visits.visit_type_id 
205 205
                                                                 AND visit_type.group_id = :visitGroupId)
@@ -207,99 +207,99 @@  discard block
 block discarded – undo
207 207
                                                             AND state_investigator_form !='Done' 
208 208
                                                             AND upload_status='Done'");
209 209
 
210
-        $visitQuery->execute(array(
211
-            'visitGroupId' => $this->visitGroupObject->groupId
212
-        ));
210
+		$visitQuery->execute(array(
211
+			'visitGroupId' => $this->visitGroupObject->groupId
212
+		));
213 213
 
214
-        $visitIds = $visitQuery->fetchAll(PDO::FETCH_COLUMN);
214
+		$visitIds = $visitQuery->fetchAll(PDO::FETCH_COLUMN);
215 215
 
216
-        $visitObjectArray = [];
217
-        foreach ($visitIds as $id_visit) {
218
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
219
-        }
216
+		$visitObjectArray = [];
217
+		foreach ($visitIds as $id_visit) {
218
+			$visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
219
+		}
220 220
 
221
-        return $visitObjectArray;
222
-    }
221
+		return $visitObjectArray;
222
+	}
223 223
 
224
-    /**
225
-     * Return studie's created visits
226
-     */
227
-    public function getCreatedVisits(bool $deleted = false): array
228
-    {
224
+	/**
225
+	 * Return studie's created visits
226
+	 */
227
+	public function getCreatedVisits(bool $deleted = false): array
228
+	{
229 229
 
230
-        $uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
230
+		$uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
231 231
                                                     INNER JOIN visit_type ON 
232 232
                                                         (visit_type.id=visits.visit_type_id 
233 233
                                                         AND visit_type.group_id = :visitGroupId)
234 234
                                                     AND deleted = :deleted 
235 235
                                                     ORDER BY patient_code, visit_type.visit_order');
236 236
 
237
-        $uploadedVisitQuery->execute(array(
238
-            'deleted' => intval($deleted),
239
-            'visitGroupId' => $this->visitGroupObject->groupId
240
-        ));
237
+		$uploadedVisitQuery->execute(array(
238
+			'deleted' => intval($deleted),
239
+			'visitGroupId' => $this->visitGroupObject->groupId
240
+		));
241 241
 
242
-        $uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
242
+		$uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
243 243
 
244
-        $visitObjectArray = [];
245
-        foreach ($uploadedVisitIds as $id_visit) {
246
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
247
-        }
244
+		$visitObjectArray = [];
245
+		foreach ($uploadedVisitIds as $id_visit) {
246
+			$visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
247
+		}
248 248
 
249
-        return $visitObjectArray;
250
-    }
249
+		return $visitObjectArray;
250
+	}
251 251
 
252
-    /**
253
-     * Determine all patient status for a specific visitType
254
-     */
255
-    public function getPatientVisitStatusForVisitType(Visit_Type $visitType)
256
-    {
252
+	/**
253
+	 * Determine all patient status for a specific visitType
254
+	 */
255
+	public function getPatientVisitStatusForVisitType(Visit_Type $visitType)
256
+	{
257 257
 
258
-        //Get patients list in this study
259
-        $allPatients = $this->studyObject->getAllPatientsInStudy();
258
+		//Get patients list in this study
259
+		$allPatients = $this->studyObject->getAllPatientsInStudy();
260 260
 
261
-        $results = [];
261
+		$results = [];
262 262
 
263
-        foreach ($allPatients as $patient) {
263
+		foreach ($allPatients as $patient) {
264 264
 
265
-            $patientCenter = $patient->getPatientCenter();
266
-            $visitManager = $patient->getPatientVisitManager($this->visitGroupObject);
265
+			$patientCenter = $patient->getPatientCenter();
266
+			$visitManager = $patient->getPatientVisitManager($this->visitGroupObject);
267 267
 
268
-            $patientData = [];
269
-            $patientData['center'] = $patientCenter->name;
270
-            $patientData['country'] = $patientCenter->countryName;
271
-            $patientData['firstname'] = $patient->patientFirstName;
272
-            $patientData['lastname'] = $patient->patientLastName;
273
-            $patientData['birthdate'] = $patient->patientBirthDate;
274
-            $patientData['registration_date'] = $patient->patientRegistrationDate;
268
+			$patientData = [];
269
+			$patientData['center'] = $patientCenter->name;
270
+			$patientData['country'] = $patientCenter->countryName;
271
+			$patientData['firstname'] = $patient->patientFirstName;
272
+			$patientData['lastname'] = $patient->patientLastName;
273
+			$patientData['birthdate'] = $patient->patientBirthDate;
274
+			$patientData['registration_date'] = $patient->patientRegistrationDate;
275 275
 
276
-            $visitStatus = $visitManager->determineVisitStatus($visitType->name);
276
+			$visitStatus = $visitManager->determineVisitStatus($visitType->name);
277 277
 
278
-            $results[$patient->patientCode] = array_merge($patientData, $visitStatus);
279
-        }
278
+			$results[$patient->patientCode] = array_merge($patientData, $visitStatus);
279
+		}
280 280
 
281
-        return $results;
282
-    }
281
+		return $results;
282
+	}
283 283
 
284
-    /**
285
-     * Determine all visits status for all visit type for all patients
286
-     */
287
-    public function getPatientsAllVisitsStatus()
288
-    {
284
+	/**
285
+	 * Determine all visits status for all visit type for all patients
286
+	 */
287
+	public function getPatientsAllVisitsStatus()
288
+	{
289 289
 
290
-        //Get ordered list of possible visits in this study
291
-        $allVisitsType = $this->visitGroupObject->getAllVisitTypesOfGroup();
290
+		//Get ordered list of possible visits in this study
291
+		$allVisitsType = $this->visitGroupObject->getAllVisitTypesOfGroup();
292 292
 
293
-        $results = [];
293
+		$results = [];
294 294
 
295
-        foreach ($allVisitsType as $visitType) {
295
+		foreach ($allVisitsType as $visitType) {
296 296
 
297
-            $allPatientStatus = $this->getPatientVisitStatusForVisitType($visitType);
297
+			$allPatientStatus = $this->getPatientVisitStatusForVisitType($visitType);
298 298
 
299
-            $results[$visitType->name] = $allPatientStatus;
300
-            //array_push($results, ...$allPatientStatus);
301
-        }
299
+			$results[$visitType->name] = $allPatientStatus;
300
+			//array_push($results, ...$allPatientStatus);
301
+		}
302 302
 
303
-        return $results;
304
-    }
303
+		return $results;
304
+	}
305 305
 }
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,17 +116,17 @@  discard block
 block discarded – undo
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
-                if ($visitObject->isAwaitingReviewForReviewerUser($username)) $visitObjectArray[] = $visitObject;
128
-            } else {
129
-                $visitObjectArray[] = $visitObject;
127
+                if ($visitObject->isAwaitingReviewForReviewerUser($username)) $visitObjectArray[]=$visitObject;
128
+            }else {
129
+                $visitObjectArray[]=$visitObject;
130 130
             }
131 131
         }
132 132
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     public function getVisitForControllerAction(): array
141 141
     {
142 142
 
143
-        $visitsQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
143
+        $visitsQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits 
144 144
                                                     INNER JOIN visit_type ON 
145 145
                                                         (visit_type.id=visits.visit_type_id 
146 146
                                                         AND visit_type.group_id = :visitGroupId)
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
             'visitGroupId' => $this->visitGroupObject->groupId
156 156
         ));
157 157
 
158
-        $visits = $visitsQuery->fetchAll(PDO::FETCH_COLUMN);
158
+        $visits=$visitsQuery->fetchAll(PDO::FETCH_COLUMN);
159 159
 
160
-        $visitObjectArray = [];
160
+        $visitObjectArray=[];
161 161
         foreach ($visits as $visit) {
162
-            $visitObjectArray[] = new Visit($visit, $this->linkpdo);
162
+            $visitObjectArray[]=new Visit($visit, $this->linkpdo);
163 163
         }
164 164
 
165 165
         return $visitObjectArray;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     public function getVisitWithQCStatus($qcStatus): array
172 172
     {
173 173
 
174
-        $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
174
+        $visitQuery=$this->linkpdo->prepare("SELECT id_visit FROM visits 
175 175
                                                         INNER JOIN visit_type ON 
176 176
                                                             (visit_type.id=visits.visit_type_id 
177 177
                                                             AND visit_type.group_id = :visitGroupId)
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
             'qcStatus' => $qcStatus,
184 184
             'visitGroupId' => $this->visitGroupObject->groupId
185 185
         ));
186
-        $visitIds = $visitQuery->fetchall(PDO::FETCH_COLUMN);
186
+        $visitIds=$visitQuery->fetchall(PDO::FETCH_COLUMN);
187 187
 
188
-        $visitObjectArray = [];
188
+        $visitObjectArray=[];
189 189
         foreach ($visitIds as $id_visit) {
190
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
190
+            $visitObjectArray[]=new Visit($id_visit, $this->linkpdo);
191 191
         }
192 192
 
193 193
         return $visitObjectArray;
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function getVisitsMissingInvestigatorForm(): array
200 200
     {
201 201
 
202
-        $visitQuery = $this->linkpdo->prepare("SELECT id_visit FROM visits 
202
+        $visitQuery=$this->linkpdo->prepare("SELECT id_visit FROM visits 
203 203
                                                             INNER JOIN visit_type ON 
204 204
                                                                 (visit_type.id=visits.visit_type_id 
205 205
                                                                 AND visit_type.group_id = :visitGroupId)
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
             'visitGroupId' => $this->visitGroupObject->groupId
212 212
         ));
213 213
 
214
-        $visitIds = $visitQuery->fetchAll(PDO::FETCH_COLUMN);
214
+        $visitIds=$visitQuery->fetchAll(PDO::FETCH_COLUMN);
215 215
 
216
-        $visitObjectArray = [];
216
+        $visitObjectArray=[];
217 217
         foreach ($visitIds as $id_visit) {
218
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
218
+            $visitObjectArray[]=new Visit($id_visit, $this->linkpdo);
219 219
         }
220 220
 
221 221
         return $visitObjectArray;
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
     /**
225 225
      * Return studie's created visits
226 226
      */
227
-    public function getCreatedVisits(bool $deleted = false): array
227
+    public function getCreatedVisits(bool $deleted=false): array
228 228
     {
229 229
 
230
-        $uploadedVisitQuery = $this->linkpdo->prepare('SELECT id_visit FROM visits 
230
+        $uploadedVisitQuery=$this->linkpdo->prepare('SELECT id_visit FROM visits 
231 231
                                                     INNER JOIN visit_type ON 
232 232
                                                         (visit_type.id=visits.visit_type_id 
233 233
                                                         AND visit_type.group_id = :visitGroupId)
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
             'visitGroupId' => $this->visitGroupObject->groupId
240 240
         ));
241 241
 
242
-        $uploadedVisitIds = $uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
242
+        $uploadedVisitIds=$uploadedVisitQuery->fetchAll(PDO::FETCH_COLUMN);
243 243
 
244
-        $visitObjectArray = [];
244
+        $visitObjectArray=[];
245 245
         foreach ($uploadedVisitIds as $id_visit) {
246
-            $visitObjectArray[] = new Visit($id_visit, $this->linkpdo);
246
+            $visitObjectArray[]=new Visit($id_visit, $this->linkpdo);
247 247
         }
248 248
 
249 249
         return $visitObjectArray;
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
     {
257 257
 
258 258
         //Get patients list in this study
259
-        $allPatients = $this->studyObject->getAllPatientsInStudy();
259
+        $allPatients=$this->studyObject->getAllPatientsInStudy();
260 260
 
261
-        $results = [];
261
+        $results=[];
262 262
 
263 263
         foreach ($allPatients as $patient) {
264 264
 
265
-            $patientCenter = $patient->getPatientCenter();
266
-            $visitManager = $patient->getPatientVisitManager($this->visitGroupObject);
265
+            $patientCenter=$patient->getPatientCenter();
266
+            $visitManager=$patient->getPatientVisitManager($this->visitGroupObject);
267 267
 
268
-            $patientData = [];
269
-            $patientData['center'] = $patientCenter->name;
270
-            $patientData['country'] = $patientCenter->countryName;
271
-            $patientData['firstname'] = $patient->patientFirstName;
272
-            $patientData['lastname'] = $patient->patientLastName;
273
-            $patientData['birthdate'] = $patient->patientBirthDate;
274
-            $patientData['registration_date'] = $patient->patientRegistrationDate;
268
+            $patientData=[];
269
+            $patientData['center']=$patientCenter->name;
270
+            $patientData['country']=$patientCenter->countryName;
271
+            $patientData['firstname']=$patient->patientFirstName;
272
+            $patientData['lastname']=$patient->patientLastName;
273
+            $patientData['birthdate']=$patient->patientBirthDate;
274
+            $patientData['registration_date']=$patient->patientRegistrationDate;
275 275
 
276
-            $visitStatus = $visitManager->determineVisitStatus($visitType->name);
276
+            $visitStatus=$visitManager->determineVisitStatus($visitType->name);
277 277
 
278
-            $results[$patient->patientCode] = array_merge($patientData, $visitStatus);
278
+            $results[$patient->patientCode]=array_merge($patientData, $visitStatus);
279 279
         }
280 280
 
281 281
         return $results;
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
     {
289 289
 
290 290
         //Get ordered list of possible visits in this study
291
-        $allVisitsType = $this->visitGroupObject->getAllVisitTypesOfGroup();
291
+        $allVisitsType=$this->visitGroupObject->getAllVisitTypesOfGroup();
292 292
 
293
-        $results = [];
293
+        $results=[];
294 294
 
295 295
         foreach ($allVisitsType as $visitType) {
296 296
 
297
-            $allPatientStatus = $this->getPatientVisitStatusForVisitType($visitType);
297
+            $allPatientStatus=$this->getPatientVisitStatusForVisitType($visitType);
298 298
 
299
-            $results[$visitType->name] = $allPatientStatus;
299
+            $results[$visitType->name]=$allPatientStatus;
300 300
             //array_push($results, ...$allPatientStatus);
301 301
         }
302 302
 
Please login to merge, or discard this patch.
src/models/Study_Review_Manager.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function __construct(Study $studyObject)
27 27
 	{
28
-		$this->studyObject = $studyObject;
28
+		$this->studyObject=$studyObject;
29 29
 	}
30 30
 
31 31
 	private function getAvailableReviewersName(): Array
32 32
 	{
33 33
 		//List the Reviewers declared in the study
34
-		$reviewerUsersObjects = $this->studyObject->getUsersByRoleInStudy(User::REVIEWER);
35
-		$availableReviewers = [];
34
+		$reviewerUsersObjects=$this->studyObject->getUsersByRoleInStudy(User::REVIEWER);
35
+		$availableReviewers=[];
36 36
 		foreach ($reviewerUsersObjects as $reviewerObject) {
37
-			$availableReviewers[] = $reviewerObject->lastName . " " . $reviewerObject->firstName;
37
+			$availableReviewers[]=$reviewerObject->lastName." ".$reviewerObject->firstName;
38 38
 		}
39 39
 
40 40
 		return $availableReviewers;
@@ -48,45 +48,45 @@  discard block
 block discarded – undo
48 48
 	public function getReviewsDetailsByVisit() : Array
49 49
 	{
50 50
 
51
-		$availableReviewers = $this->getAvailableReviewersName();
51
+		$availableReviewers=$this->getAvailableReviewersName();
52 52
 		//Retrieve created Visit from the study Object
53
-		$createdVisitObjects = $this->studyObject->getAllCreatedVisits();
53
+		$createdVisitObjects=$this->studyObject->getAllCreatedVisits();
54 54
 
55 55
 		//GlobalMap
56
-		$reviewdetailsMap = [];
56
+		$reviewdetailsMap=[];
57 57
 
58 58
 		foreach ($createdVisitObjects as $createdVisit) {
59 59
 			if ($createdVisit->stateQualityControl == Visit::QC_ACCEPTED && $createdVisit->visitTypeObject->reviewNeeded) {
60 60
 				//If QC Accepted and review needed we analyze it
61
-				$newVisit['visitId'] = $createdVisit->id_visit;
62
-				$newVisit['visitModality'] = $createdVisit->visitGroupObject->groupModality;
63
-				$newVisit['patientNumber'] = $createdVisit->patientCode;
64
-				$newVisit['visit'] = $createdVisit->visitType;
65
-				$newVisit['acquisitionDate'] = $createdVisit->acquisitionDate;
66
-				$newVisit['reviewStatus'] = $createdVisit->reviewStatus;
61
+				$newVisit['visitId']=$createdVisit->id_visit;
62
+				$newVisit['visitModality']=$createdVisit->visitGroupObject->groupModality;
63
+				$newVisit['patientNumber']=$createdVisit->patientCode;
64
+				$newVisit['visit']=$createdVisit->visitType;
65
+				$newVisit['acquisitionDate']=$createdVisit->acquisitionDate;
66
+				$newVisit['reviewStatus']=$createdVisit->reviewStatus;
67 67
 				//Retrieve review
68 68
 				try {
69
-					$reviewObjects = $createdVisit->getReviewsObject(false);
70
-				} catch (Exception $e) {
71
-					$reviewObjects = [];
69
+					$reviewObjects=$createdVisit->getReviewsObject(false);
70
+				}catch (Exception $e) {
71
+					$reviewObjects=[];
72 72
 				}
73 73
 
74
-				$newVisit['numberOfReview'] = count($reviewObjects);
75
-				$newVisit['reviewDoneBy'] = [];
76
-				$newVisit['reviewDetailsArray'] = [];
74
+				$newVisit['numberOfReview']=count($reviewObjects);
75
+				$newVisit['reviewDoneBy']=[];
76
+				$newVisit['reviewDetailsArray']=[];
77 77
 				foreach ($reviewObjects as $review) {
78
-					$reviewerObject = $review->getUserObject();
79
-					$details['user'] = $reviewerObject->lastName . " " . $reviewerObject->firstName;
80
-					$details['date'] = $review->reviewDate;
81
-					$newVisit['reviewDetailsArray'][] = $details;
82
-					$newVisit['reviewDoneBy'][] = $reviewerObject->lastName . " " . $reviewerObject->firstName;
78
+					$reviewerObject=$review->getUserObject();
79
+					$details['user']=$reviewerObject->lastName." ".$reviewerObject->firstName;
80
+					$details['date']=$review->reviewDate;
81
+					$newVisit['reviewDetailsArray'][]=$details;
82
+					$newVisit['reviewDoneBy'][]=$reviewerObject->lastName." ".$reviewerObject->firstName;
83 83
 				}
84 84
 
85 85
 				//Determine missing reviewer for this visit
86
-				$newVisit['reviewNotDoneBy'] = array_diff($availableReviewers, $newVisit['reviewDoneBy']);
86
+				$newVisit['reviewNotDoneBy']=array_diff($availableReviewers, $newVisit['reviewDoneBy']);
87 87
 
88 88
 				//Add all data to the global map
89
-				$reviewdetailsMap[$createdVisit->id_visit] = $newVisit;
89
+				$reviewdetailsMap[$createdVisit->id_visit]=$newVisit;
90 90
 			}
91 91
 		}
92 92
 		return $reviewdetailsMap;
Please login to merge, or discard this patch.
src/models/Visit_Type.php 2 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -18,108 +18,108 @@
 block discarded – undo
18 18
  */
19 19
 Class Visit_Type{
20 20
     
21
-    public $id;
22
-    public $groupId;
23
-    public $name;
24
-    public $tableReviewSpecificName;
25
-    public $visitOrder;
26
-    public $localFormNeeded;
27
-    public $qcNeeded;
28
-    public $reviewNeeded;
29
-    public $optionalVisit;
30
-    public $limitLowDays;
31
-    public $limitUpDays;
32
-    public $anonProfile;
21
+	public $id;
22
+	public $groupId;
23
+	public $name;
24
+	public $tableReviewSpecificName;
25
+	public $visitOrder;
26
+	public $localFormNeeded;
27
+	public $qcNeeded;
28
+	public $reviewNeeded;
29
+	public $optionalVisit;
30
+	public $limitLowDays;
31
+	public $limitUpDays;
32
+	public $anonProfile;
33 33
 
34
-    public $linkpdo;
34
+	public $linkpdo;
35 35
     
36
-    public function __construct(PDO $linkpdo, int $visitTypeId){
36
+	public function __construct(PDO $linkpdo, int $visitTypeId){
37 37
         
38
-        $this->linkpdo=$linkpdo;
39
-        $visitTypeQuery = $this->linkpdo->prepare('SELECT * FROM visit_type WHERE id = :visitTypeId');
40
-        $visitTypeQuery->execute(array('visitTypeId' => $visitTypeId));
41
-        $visitType=$visitTypeQuery->fetch(PDO::FETCH_ASSOC);
38
+		$this->linkpdo=$linkpdo;
39
+		$visitTypeQuery = $this->linkpdo->prepare('SELECT * FROM visit_type WHERE id = :visitTypeId');
40
+		$visitTypeQuery->execute(array('visitTypeId' => $visitTypeId));
41
+		$visitType=$visitTypeQuery->fetch(PDO::FETCH_ASSOC);
42 42
 
43
-        $this->id=$visitType['id'];
44
-        $this->groupId=$visitType['group_id'];
45
-        $this->name=$visitType['name'];
46
-        $this->tableReviewSpecificName=$visitType['table_review_specific'];
47
-        $this->visitOrder=$visitType['visit_order'];
48
-        $this->localFormNeeded=$visitType['local_form_needed'];
49
-        $this->qcNeeded=$visitType['qc_needed'];
50
-        $this->reviewNeeded=$visitType['review_needed'];
51
-        $this->optionalVisit=$visitType['optional'];
52
-        $this->limitLowDays=$visitType['limit_low_days'];
53
-        $this->limitUpDays=$visitType['limit_up_days'];
54
-        $this->anonProfile=$visitType['anon_profile'];
43
+		$this->id=$visitType['id'];
44
+		$this->groupId=$visitType['group_id'];
45
+		$this->name=$visitType['name'];
46
+		$this->tableReviewSpecificName=$visitType['table_review_specific'];
47
+		$this->visitOrder=$visitType['visit_order'];
48
+		$this->localFormNeeded=$visitType['local_form_needed'];
49
+		$this->qcNeeded=$visitType['qc_needed'];
50
+		$this->reviewNeeded=$visitType['review_needed'];
51
+		$this->optionalVisit=$visitType['optional'];
52
+		$this->limitLowDays=$visitType['limit_low_days'];
53
+		$this->limitUpDays=$visitType['limit_up_days'];
54
+		$this->anonProfile=$visitType['anon_profile'];
55 55
         
56
-    }
56
+	}
57 57
 
58
-    public static function getVisitTypeByName($groupId, String $visitName,PDO $linkpdo) : Visit_Type {
59
-        $visitTypeQuery = $linkpdo->prepare('SELECT id FROM visit_type WHERE group_id = :groupId AND name= :name');
60
-        $visitTypeQuery->execute(array('groupId' => $groupId, 'name'=>$visitName));
61
-        $visitTypeId=$visitTypeQuery->fetch(PDO::FETCH_COLUMN);
62
-        return new Visit_Type($linkpdo, $visitTypeId);
58
+	public static function getVisitTypeByName($groupId, String $visitName,PDO $linkpdo) : Visit_Type {
59
+		$visitTypeQuery = $linkpdo->prepare('SELECT id FROM visit_type WHERE group_id = :groupId AND name= :name');
60
+		$visitTypeQuery->execute(array('groupId' => $groupId, 'name'=>$visitName));
61
+		$visitTypeId=$visitTypeQuery->fetch(PDO::FETCH_COLUMN);
62
+		return new Visit_Type($linkpdo, $visitTypeId);
63 63
 
64
-    }
64
+	}
65 65
     
66
-    /**
67
-     * Return name of specific table of this visit type
68
-     * @return array
69
-     */
70
-    public function getSpecificFormColumn() : Array {
71
-        $visitsTypeColumnQuery=$this->linkpdo->prepare('SELECT `COLUMN_NAME`
66
+	/**
67
+	 * Return name of specific table of this visit type
68
+	 * @return array
69
+	 */
70
+	public function getSpecificFormColumn() : Array {
71
+		$visitsTypeColumnQuery=$this->linkpdo->prepare('SELECT `COLUMN_NAME`
72 72
                                             FROM `INFORMATION_SCHEMA`.`COLUMNS`
73 73
                                             WHERE  `TABLE_NAME`="'.$this->tableReviewSpecificName.'"');
74
-        $visitsTypeColumnQuery->execute();
75
-        $columnsSpecific=$visitsTypeColumnQuery->fetchAll(PDO::FETCH_COLUMN);
74
+		$visitsTypeColumnQuery->execute();
75
+		$columnsSpecific=$visitsTypeColumnQuery->fetchAll(PDO::FETCH_COLUMN);
76 76
         
77
-        return $columnsSpecific;
78
-    }
77
+		return $columnsSpecific;
78
+	}
79 79
     
80
-    /**
81
-     * Return name and type of the specific table of this visit
82
-     * @return array
83
-     */
84
-    public function getSpecificTableInputType() : Array {
85
-        $query = $this->linkpdo->prepare('SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME="'.$this->tableReviewSpecificName.'"');
86
-        $query->execute();
87
-        $datas=$query->fetchAll(PDO::FETCH_ASSOC);
80
+	/**
81
+	 * Return name and type of the specific table of this visit
82
+	 * @return array
83
+	 */
84
+	public function getSpecificTableInputType() : Array {
85
+		$query = $this->linkpdo->prepare('SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME="'.$this->tableReviewSpecificName.'"');
86
+		$query->execute();
87
+		$datas=$query->fetchAll(PDO::FETCH_ASSOC);
88 88
         
89
-        return $datas;
89
+		return $datas;
90 90
         
91
-    }
91
+	}
92 92
 
93
-    public function getVisitGroup() : Visit_Group{
94
-        return new Visit_Group($this->linkpdo, $this->groupId);
95
-    }
93
+	public function getVisitGroup() : Visit_Group{
94
+		return new Visit_Group($this->linkpdo, $this->groupId);
95
+	}
96 96
     
97
-    public static function createVisitType(string $studyName, Visit_Group $visitGroup, String $visitName, int $order, int $limitLowDays, int $limitUpDays, bool $localFormNeed, bool $qcNeeded, bool $reviewNeeded, bool $optional, String $anonProfile, PDO $linkpdo){
97
+	public static function createVisitType(string $studyName, Visit_Group $visitGroup, String $visitName, int $order, int $limitLowDays, int $limitUpDays, bool $localFormNeed, bool $qcNeeded, bool $reviewNeeded, bool $optional, String $anonProfile, PDO $linkpdo){
98 98
         
99
-        $req = $linkpdo->prepare('INSERT INTO visit_type (group_id, name, table_review_specific, visit_order, local_form_needed, qc_needed, review_needed, optional, limit_low_days, limit_up_days, anon_profile)
99
+		$req = $linkpdo->prepare('INSERT INTO visit_type (group_id, name, table_review_specific, visit_order, local_form_needed, qc_needed, review_needed, optional, limit_low_days, limit_up_days, anon_profile)
100 100
                                       VALUES(:groupId, :visitName, :tableSpecific, :order, :localFormNeeded, :qcNeeded, :reviewNeeded, :optional, :limitLowDays, :limitUpDays, :anonProfile)');
101 101
         
102
-        $tableSpecificName=$visitGroup->groupModality."_".$studyName."_".$visitName;
102
+		$tableSpecificName=$visitGroup->groupModality."_".$studyName."_".$visitName;
103 103
 
104
-        $req->execute(array('groupId' => $visitGroup->groupId,
105
-            'visitName'=>$visitName,
106
-            'tableSpecific'=>$tableSpecificName,
107
-            'order'=>intval($order),
108
-            'localFormNeeded'=>intval($localFormNeed),
109
-            'qcNeeded'=>intval($qcNeeded),
110
-            'reviewNeeded'=>intval($reviewNeeded),
111
-            'optional'=>intval($optional),
112
-            'limitLowDays'=>intval($limitLowDays),
113
-            'limitUpDays'=>intval($limitUpDays),
114
-            'anonProfile'=>$anonProfile
115
-        ));
104
+		$req->execute(array('groupId' => $visitGroup->groupId,
105
+			'visitName'=>$visitName,
106
+			'tableSpecific'=>$tableSpecificName,
107
+			'order'=>intval($order),
108
+			'localFormNeeded'=>intval($localFormNeed),
109
+			'qcNeeded'=>intval($qcNeeded),
110
+			'reviewNeeded'=>intval($reviewNeeded),
111
+			'optional'=>intval($optional),
112
+			'limitLowDays'=>intval($limitLowDays),
113
+			'limitUpDays'=>intval($limitUpDays),
114
+			'anonProfile'=>$anonProfile
115
+		));
116 116
         
117
-        //Create specific table of the visit for form with relation with the review table
118
-        $req = $linkpdo->prepare(' CREATE TABLE '.$tableSpecificName.' (id_review integer(11) NOT NULL, PRIMARY KEY (id_review));
117
+		//Create specific table of the visit for form with relation with the review table
118
+		$req = $linkpdo->prepare(' CREATE TABLE '.$tableSpecificName.' (id_review integer(11) NOT NULL, PRIMARY KEY (id_review));
119 119
             ALTER TABLE '.$tableSpecificName.' ADD FOREIGN KEY fk_idReview (id_review) REFERENCES reviews(id_review);
120 120
             ALTER TABLE '.$tableSpecificName.' ADD PRIMARY KEY (`id_review`); ');
121 121
         
122
-        $req->execute();
123
-    }
122
+		$req->execute();
123
+	}
124 124
     
125 125
 }
126 126
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * Acces data of Visit Type table
18 18
  */
19
-Class Visit_Type{
19
+Class Visit_Type {
20 20
     
21 21
     public $id;
22 22
     public $groupId;
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 
34 34
     public $linkpdo;
35 35
     
36
-    public function __construct(PDO $linkpdo, int $visitTypeId){
36
+    public function __construct(PDO $linkpdo, int $visitTypeId) {
37 37
         
38 38
         $this->linkpdo=$linkpdo;
39
-        $visitTypeQuery = $this->linkpdo->prepare('SELECT * FROM visit_type WHERE id = :visitTypeId');
39
+        $visitTypeQuery=$this->linkpdo->prepare('SELECT * FROM visit_type WHERE id = :visitTypeId');
40 40
         $visitTypeQuery->execute(array('visitTypeId' => $visitTypeId));
41 41
         $visitType=$visitTypeQuery->fetch(PDO::FETCH_ASSOC);
42 42
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         
56 56
     }
57 57
 
58
-    public static function getVisitTypeByName($groupId, String $visitName,PDO $linkpdo) : Visit_Type {
59
-        $visitTypeQuery = $linkpdo->prepare('SELECT id FROM visit_type WHERE group_id = :groupId AND name= :name');
58
+    public static function getVisitTypeByName($groupId, String $visitName, PDO $linkpdo) : Visit_Type {
59
+        $visitTypeQuery=$linkpdo->prepare('SELECT id FROM visit_type WHERE group_id = :groupId AND name= :name');
60 60
         $visitTypeQuery->execute(array('groupId' => $groupId, 'name'=>$visitName));
61 61
         $visitTypeId=$visitTypeQuery->fetch(PDO::FETCH_COLUMN);
62 62
         return new Visit_Type($linkpdo, $visitTypeId);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      * @return array
83 83
      */
84 84
     public function getSpecificTableInputType() : Array {
85
-        $query = $this->linkpdo->prepare('SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME="'.$this->tableReviewSpecificName.'"');
85
+        $query=$this->linkpdo->prepare('SELECT COLUMN_NAME, COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME="'.$this->tableReviewSpecificName.'"');
86 86
         $query->execute();
87 87
         $datas=$query->fetchAll(PDO::FETCH_ASSOC);
88 88
         
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
         return new Visit_Group($this->linkpdo, $this->groupId);
95 95
     }
96 96
     
97
-    public static function createVisitType(string $studyName, Visit_Group $visitGroup, String $visitName, int $order, int $limitLowDays, int $limitUpDays, bool $localFormNeed, bool $qcNeeded, bool $reviewNeeded, bool $optional, String $anonProfile, PDO $linkpdo){
97
+    public static function createVisitType(string $studyName, Visit_Group $visitGroup, String $visitName, int $order, int $limitLowDays, int $limitUpDays, bool $localFormNeed, bool $qcNeeded, bool $reviewNeeded, bool $optional, String $anonProfile, PDO $linkpdo) {
98 98
         
99
-        $req = $linkpdo->prepare('INSERT INTO visit_type (group_id, name, table_review_specific, visit_order, local_form_needed, qc_needed, review_needed, optional, limit_low_days, limit_up_days, anon_profile)
99
+        $req=$linkpdo->prepare('INSERT INTO visit_type (group_id, name, table_review_specific, visit_order, local_form_needed, qc_needed, review_needed, optional, limit_low_days, limit_up_days, anon_profile)
100 100
                                       VALUES(:groupId, :visitName, :tableSpecific, :order, :localFormNeeded, :qcNeeded, :reviewNeeded, :optional, :limitLowDays, :limitUpDays, :anonProfile)');
101 101
         
102 102
         $tableSpecificName=$visitGroup->groupModality."_".$studyName."_".$visitName;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         ));
116 116
         
117 117
         //Create specific table of the visit for form with relation with the review table
118
-        $req = $linkpdo->prepare(' CREATE TABLE '.$tableSpecificName.' (id_review integer(11) NOT NULL, PRIMARY KEY (id_review));
118
+        $req=$linkpdo->prepare(' CREATE TABLE '.$tableSpecificName.' (id_review integer(11) NOT NULL, PRIMARY KEY (id_review));
119 119
             ALTER TABLE '.$tableSpecificName.' ADD FOREIGN KEY fk_idReview (id_review) REFERENCES reviews(id_review);
120 120
             ALTER TABLE '.$tableSpecificName.' ADD PRIMARY KEY (`id_review`); ');
121 121
         
Please login to merge, or discard this patch.