File tree 5 files changed +131
-0
lines changed
5 files changed +131
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ class OETrial_API extends BaseAPI
4
+ {
5
+ /**
6
+ * @param $type
7
+ * @param $partial
8
+ *
9
+ * @return bool|string
10
+ */
11
+ public function findViewFile ($ type , $ partial )
12
+ {
13
+ $ viewFile = Yii::getPathOfAlias ('OETrial.views. ' . $ type . '. ' . $ partial ) . '.php ' ;
14
+
15
+ if (file_exists ($ viewFile )) {
16
+ return $ viewFile ;
17
+ }
18
+
19
+ return false ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change 10
10
'restricted ' => array ('TaskAdministerTrials ' ),
11
11
),
12
12
),
13
+ 'module_partials ' => array (
14
+ 'patient_summary_column1 ' => array (
15
+ 'OETrial ' => array (
16
+ '_patient_trials ' ,
17
+ ),
18
+ ),
19
+ ),
13
20
),
14
21
);
Original file line number Diff line number Diff line change @@ -44,8 +44,14 @@ class Trial extends BaseActiveRecordVersioned
44
44
*/
45
45
const STATUS_CANCELLED = 3 ;
46
46
47
+ /**
48
+ * The trial type for non-Intervention trial (meaning there are no restrictions on assigning patients to this the trial)
49
+ */
47
50
const TRIAL_TYPE_NON_INTERVENTION = 0 ;
48
51
52
+ /**
53
+ * The trial type for Intervention trials (meaning a patient can only be assigned to one ongoing Intervention trial at a time)
54
+ */
49
55
const TRIAL_TYPE_INTERVENTION = 1 ;
50
56
51
57
/**
@@ -133,6 +139,25 @@ public static function getTrialTypeOptions()
133
139
);
134
140
}
135
141
142
+ /**
143
+ * Returns the trial type as a string
144
+ *
145
+ * @return string The trial type
146
+ */
147
+ public function getTypeString ()
148
+ {
149
+ return self ::getTrialTypeOptions ()[$ this ->trial_type ];
150
+ }
151
+
152
+ /**
153
+ * Returns the date this trial was created as a string
154
+ *
155
+ * @return string The created date
156
+ */
157
+ public function getCreatedDateForDisplay ()
158
+ {
159
+ return Helper::formatFuzzyDate ($ this ->created_date );
160
+ }
136
161
137
162
/**
138
163
* @return array relational rules.
Original file line number Diff line number Diff line change @@ -54,6 +54,29 @@ public static function getAllowedStatusRange()
54
54
);
55
55
}
56
56
57
+
58
+ /**
59
+ * @return array
60
+ */
61
+ public static function getStatusOptions ()
62
+ {
63
+ return array (
64
+ self ::STATUS_SHORTLISTED => 'Shortlisted ' ,
65
+ self ::STATUS_ACCEPTED => 'Accepted ' ,
66
+ self ::STATUS_REJECTED => 'Rejected ' ,
67
+ );
68
+ }
69
+
70
+ /**
71
+ * Returns the status as a displayable string
72
+ *
73
+ * @return string The status string
74
+ */
75
+ public function getStatusForDisplay ()
76
+ {
77
+ return self ::getStatusOptions ()[$ this ->patient_status ];
78
+ }
79
+
57
80
/**
58
81
* @return string the associated database table name
59
82
*/
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /* @var $this PatientController */
3
+ ?>
4
+ <section class="box patient-info js-toggle-container">
5
+ <h3 class="box-title">Trials:</h3>
6
+ <a href="#" class="toggle-trigger toggle-hide js-toggle">
7
+ <span class="icon-showhide">
8
+ Show/hide this section
9
+ </span>
10
+ </a>
11
+ <a href="#" class="toggle-trigger toggle-hide js-toggle">
12
+ <span class="icon-showhide">
13
+ Show/hide this section
14
+ </span>
15
+ </a>
16
+ </header>
17
+
18
+ <div class="js-toggle-body">
19
+
20
+ <table class="plain patient-data">
21
+ <thead>
22
+ <tr>
23
+ <th>Trial</th>
24
+ <th>Control Status</th>
25
+ <th>Trial Status</th>
26
+ <th>Trial Type</th>
27
+ <th>Date Started</th>
28
+ <th>Date Ended</th>
29
+ </tr>
30
+ </thead>
31
+ <tbody>
32
+ <?php foreach ($ this ->patient ->trials as $ trialPatient ): ?>
33
+ <tr>
34
+ <td><?php
35
+ if (Trial::checkTrialAccess (Yii::app ()->user , $ trialPatient ->trial_id ,
36
+ UserTrialPermission::PERMISSION_VIEW )
37
+ ) {
38
+ echo Chtml::link (CHtml::encode ($ trialPatient ->trial ->name ),
39
+ Yii::app ()->controller ->createUrl ('/OETrial/trial/view ' , array ('id ' => $ trialPatient ->trial_id )));
40
+ } else {
41
+ echo CHtml::encode ($ trialPatient ->trial ->name );
42
+ }
43
+ ?>
44
+ </td>
45
+ <td><?php echo 'TODO ' ; //TODO; ?> </td>
46
+ <td><?php echo $ trialPatient ->getStatusForDisplay (); ?> </td>
47
+ <td><?php echo $ trialPatient ->trial ->getTypeString (); ?> </td>
48
+ <td><?php echo $ trialPatient ->trial ->getCreatedDateForDisplay (); ?> </td>
49
+ <td><?php echo 'TODO ' ; //TODO; ?> </td>
50
+ </tr>
51
+ <?php endforeach ; ?>
52
+ </tbody>
53
+ </table>
54
+ </div>
55
+ </section>
You can’t perform that action at this time.
0 commit comments