Passed
Branch dev (0fab21)
by Salim
05:13
created
src/controllers/investigator/specific_form_controller.php 3 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -33,56 +33,56 @@
 block discarded – undo
33 33
 
34 34
 if($permissionResults){
35 35
     
36
-    //Determine if calling local or reviewer form
37
-    $local = ($_SESSION['role']==User::REVIEWER) ? false : true ;
38
-    $formProcessorObject=$visitObject->getFromProcessor($local, $username);
36
+	//Determine if calling local or reviewer form
37
+	$local = ($_SESSION['role']==User::REVIEWER) ? false : true ;
38
+	$formProcessorObject=$visitObject->getFromProcessor($local, $username);
39 39
     
40
-    if (!empty($_POST['draft']) || !empty($_POST['validate']) ){
41
-        //Process the form
42
-        if(!empty($_POST['validate'])){
43
-            $validate=true;
44
-        }else {
45
-            $validate=false;
46
-        }
47
-        try{
48
-            $formProcessorObject->saveForm($_POST, $validate);
49
-            echo(json_encode(true));
50
-        }catch(Exception $e){
51
-            echo(json_encode(false));
52
-        }
40
+	if (!empty($_POST['draft']) || !empty($_POST['validate']) ){
41
+		//Process the form
42
+		if(!empty($_POST['validate'])){
43
+			$validate=true;
44
+		}else {
45
+			$validate=false;
46
+		}
47
+		try{
48
+			$formProcessorObject->saveForm($_POST, $validate);
49
+			echo(json_encode(true));
50
+		}catch(Exception $e){
51
+			echo(json_encode(false));
52
+		}
53 53
 
54
-    }else{
55
-        //Load Specific form
54
+	}else{
55
+		//Load Specific form
56 56
         
57
-        //If form not needed for investigator, return and do not output the form
58
-        if ( ! $isLocalformNeeded && in_array( $_SESSION['role'], array(User::INVESTIGATOR, User::CONTROLLER) ) ) {
59
-            exit();
60
-        }
57
+		//If form not needed for investigator, return and do not output the form
58
+		if ( ! $isLocalformNeeded && in_array( $_SESSION['role'], array(User::INVESTIGATOR, User::CONTROLLER) ) ) {
59
+			exit();
60
+		}
61 61
         
62
-        if($_SESSION['role']==User::INVESTIGATOR || ($_SESSION['role']==User::REVIEWER && $visitObject->reviewAvailable) ){
63
-            $roleDisable=false;
64
-        }else{
65
-            $roleDisable=true;
66
-        }
62
+		if($_SESSION['role']==User::INVESTIGATOR || ($_SESSION['role']==User::REVIEWER && $visitObject->reviewAvailable) ){
63
+			$roleDisable=false;
64
+		}else{
65
+			$roleDisable=true;
66
+		}
67 67
         
68
-        //Return local form or user's review according to parameters which retrieved the form processor
69
-        //of this study
70
-        $reviewObject=$formProcessorObject->reviewObject;
68
+		//Return local form or user's review according to parameters which retrieved the form processor
69
+		//of this study
70
+		$reviewObject=$formProcessorObject->reviewObject;
71 71
         
72
-        if(!empty($reviewObject)){
73
-            $validatedForm=$reviewObject->validated;
74
-            $results=$reviewObject->getSpecificData();
75
-        }else{
76
-            $validatedForm=false;
77
-        }
72
+		if(!empty($reviewObject)){
73
+			$validatedForm=$reviewObject->validated;
74
+			$results=$reviewObject->getSpecificData();
75
+		}else{
76
+			$validatedForm=false;
77
+		}
78 78
         
79 79
 
80
-        $visitGroupModality=$visitObject->visitGroupObject->groupModality;
81
-        require 'views/investigator/specific_form_view.php';
80
+		$visitGroupModality=$visitObject->visitGroupObject->groupModality;
81
+		require 'views/investigator/specific_form_view.php';
82 82
         
83
-    }
83
+	}
84 84
     
85 85
 }else {
86
-    require 'includes/no_access.php';
86
+	require 'includes/no_access.php';
87 87
 }
88 88
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -21,47 +21,47 @@  discard block
 block discarded – undo
21 21
 $id_visit=$_POST['id_visit'];
22 22
 $patient_num=$_POST['patient_num'];
23 23
 $type_visit=$_POST['type_visit'];
24
-$username= $_SESSION['username'];
25
-$study = $_SESSION['study'];
24
+$username=$_SESSION['username'];
25
+$study=$_SESSION['study'];
26 26
 
27 27
 $userObject=new User($username, $linkpdo);
28
-$permissionResults = $userObject->isVisitAllowed($id_visit, $_SESSION['role']);
28
+$permissionResults=$userObject->isVisitAllowed($id_visit, $_SESSION['role']);
29 29
 
30 30
 
31 31
 $visitObject=new Visit($id_visit, $linkpdo);
32
-$isLocalformNeeded = $visitObject->getVisitCharacteristics()->localFormNeeded;
32
+$isLocalformNeeded=$visitObject->getVisitCharacteristics()->localFormNeeded;
33 33
 
34
-if($permissionResults){
34
+if ($permissionResults) {
35 35
     
36 36
     //Determine if calling local or reviewer form
37
-    $local = ($_SESSION['role']==User::REVIEWER) ? false : true ;
37
+    $local=($_SESSION['role'] == User::REVIEWER) ? false : true;
38 38
     $formProcessorObject=$visitObject->getFromProcessor($local, $username);
39 39
     
40
-    if (!empty($_POST['draft']) || !empty($_POST['validate']) ){
40
+    if (!empty($_POST['draft']) || !empty($_POST['validate'])) {
41 41
         //Process the form
42
-        if(!empty($_POST['validate'])){
42
+        if (!empty($_POST['validate'])) {
43 43
             $validate=true;
44 44
         }else {
45 45
             $validate=false;
46 46
         }
47
-        try{
47
+        try {
48 48
             $formProcessorObject->saveForm($_POST, $validate);
49 49
             echo(json_encode(true));
50
-        }catch(Exception $e){
50
+        }catch (Exception $e) {
51 51
             echo(json_encode(false));
52 52
         }
53 53
 
54
-    }else{
54
+    }else {
55 55
         //Load Specific form
56 56
         
57 57
         //If form not needed for investigator, return and do not output the form
58
-        if ( ! $isLocalformNeeded && in_array( $_SESSION['role'], array(User::INVESTIGATOR, User::CONTROLLER) ) ) {
58
+        if (!$isLocalformNeeded && in_array($_SESSION['role'], array(User::INVESTIGATOR, User::CONTROLLER))) {
59 59
             exit();
60 60
         }
61 61
         
62
-        if($_SESSION['role']==User::INVESTIGATOR || ($_SESSION['role']==User::REVIEWER && $visitObject->reviewAvailable) ){
62
+        if ($_SESSION['role'] == User::INVESTIGATOR || ($_SESSION['role'] == User::REVIEWER && $visitObject->reviewAvailable)) {
63 63
             $roleDisable=false;
64
-        }else{
64
+        }else {
65 65
             $roleDisable=true;
66 66
         }
67 67
         
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
         //of this study
70 70
         $reviewObject=$formProcessorObject->reviewObject;
71 71
         
72
-        if(!empty($reviewObject)){
72
+        if (!empty($reviewObject)) {
73 73
             $validatedForm=$reviewObject->validated;
74 74
             $results=$reviewObject->getSpecificData();
75
-        }else{
75
+        }else {
76 76
             $validatedForm=false;
77 77
         }
78 78
         
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
         //Process the form
42 42
         if(!empty($_POST['validate'])){
43 43
             $validate=true;
44
-        }else {
44
+        } else {
45 45
             $validate=false;
46 46
         }
47 47
         try{
48 48
             $formProcessorObject->saveForm($_POST, $validate);
49 49
             echo(json_encode(true));
50
-        }catch(Exception $e){
50
+        } catch(Exception $e){
51 51
             echo(json_encode(false));
52 52
         }
53 53
 
54
-    }else{
54
+    } else{
55 55
         //Load Specific form
56 56
         
57 57
         //If form not needed for investigator, return and do not output the form
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         
62 62
         if($_SESSION['role']==User::INVESTIGATOR || ($_SESSION['role']==User::REVIEWER && $visitObject->reviewAvailable) ){
63 63
             $roleDisable=false;
64
-        }else{
64
+        } else{
65 65
             $roleDisable=true;
66 66
         }
67 67
         
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         if(!empty($reviewObject)){
73 73
             $validatedForm=$reviewObject->validated;
74 74
             $results=$reviewObject->getSpecificData();
75
-        }else{
75
+        } else{
76 76
             $validatedForm=false;
77 77
         }
78 78
         
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         
83 83
     }
84 84
     
85
-}else {
85
+} else {
86 86
     require 'includes/no_access.php';
87 87
 }
88 88
 
Please login to merge, or discard this patch.