@@ -63,16 +63,17 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
6363 break ;
6464 }
6565 // user input doesn't match DB, so we update the DB
66- else {
66+ else {
6767 $ setArray = array ('Resolved ' =>(string )$ val ,'ChangeDate ' =>date ("Y-m-d H:i:s " ));
6868 $ whereArray = array ('hash ' =>$ hash );
6969 $ DB ->update ('violations_resolved ' , $ setArray , $ whereArray );
7070 }
7171 }
7272 }
73- } else {
74- //if row is not found no resolve status was assigned,
75- // if selection<>0, then insert new row.
73+ }
74+ //if row is not found no resolve status was assigned,
75+ // if selection<>0, then insert new row.
76+ else {
7677 // no need to insert to DB for Unresolved value.
7778 if ($ val =='unresolved ' ){
7879 continue ;
@@ -137,24 +138,21 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
137138 // set the class variables
138139 // create user object
139140 $ user =& User::singleton ();
140- $ DB =& Database::singleton ();
141141
142142 $ config =& NDB_Config::singleton ();
143143 $ useProjects = $ config ->getSetting ("useProjects " );
144144 if ($ useProjects === "false " ) {
145145 $ useProjects = false ;
146- } else {
146+ }
147+ else {
147148 $ useProjects = true ;
148149 }
149150
150- $ dir_path = $ config ->getSetting ("imagePath " );
151-
152151 $ this ->columns = array (
153152 'v.PatientName ' ,
154153 'v.Site ' ,
155154 'v.TimeRun ' ,
156155 'v.MincFile ' ,
157- 'v.MincFileViolated ' ,
158156 'v.Series_Description as Series_Description_Or_Scan_Type ' ,
159157 'v.Problem ' ,
160158 'v.SeriesUID ' ,
@@ -167,18 +165,12 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
167165 array_splice ($ this ->columns , 2 , 0 , 'v.Subproject ' );
168166 }
169167
170- // Recreating the path (MincFileViolated field) to the minc file for the table mri_violations_log is more complicated
171- // because of the 3 cases that can occur as we pull the data from the db.
172- // 1. if the Mincfile starts with "assembly" then we need to add the directory path in front of it.
173- // 2. if the word "assembly" is there but not at the beginning, then uses it as is, the path is correct.
174- // 3. if it is not in the assembly dir, then it is in the trashbin, so we fix the path with that in mind.
175168 $ this ->query = " FROM (
176169 SELECT PatientName as PatientName,
177170 time_run as TimeRun,
178171 c.ProjectID as Project,
179172 s.SubprojectID as Subproject,
180173 minc_location as MincFile,
181- CONCAT_WS('', " . $ DB ->quote ($ dir_path ) . ",'trashbin/',SUBSTRING_INDEX(minc_location, '/', -2)) as MincFileViolated,
182174 series_description as Series_Description,
183175 'Could not identify scan type' as Problem,
184176 SeriesUID,
@@ -203,7 +195,6 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
203195 c.ProjectID as Project,
204196 s.SubprojectID as Subproject,
205197 MincFile,
206- IF(INSTR(`MincFile`, 'assembly'), IF(LEFT(`MincFile`, 8) = 'assembly',CONCAT_WS('', " . $ DB ->quote ($ dir_path ) . ",`MincFile`),`MincFile`), CONCAT_WS('', " . $ DB ->quote ($ dir_path ) . ",'trashbin/',SUBSTRING_INDEX(MincFile, '/', -2))) as MincFileViolated,
207198 mri_scan_type.Scan_type,
208199 'Protocol Violation',
209200 SeriesUID,
@@ -230,7 +221,6 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
230221 c.ProjectID as Project,
231222 s.SubprojectID as Subproject,
232223 MincFile,
233- CONCAT_WS('', " . $ DB ->quote ($ dir_path ) . ",'trashbin/',SUBSTRING_INDEX(MincFile, '/', -2)) as MincFileViolated,
234224 null,
235225 Reason,
236226 SeriesUID,
@@ -338,7 +328,8 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
338328 if (is_array ($ sites )){
339329 $ sites = array ('' => 'All ' ) + $ sites ;
340330 }
341- } else {
331+ }
332+ else {
342333 // allow only to view own site data
343334 $ site =& Site::singleton ($ user ->getData ('CenterID ' ));
344335 if ($ site ->isStudySite ()) {
@@ -404,17 +395,20 @@ class NDB_Menu_Filter_Form_mri_violations extends NDB_Menu_Filter_Form
404395 $ this ->form ->form [$ hash ]['name ' ] = "resolvable[ $ hash] " ;
405396 }
406397 if ($ key === 'Problem ' ) {
407- if ($ val === "Could not identify scan type " ) {
398+ if ($ val === "Could not identify scan type " ){
408399 $ this ->tpl_data ['join_tbl ' ] = "mri_protocol_violated_scans " ;
409- } elseif ($ val === "Protocol Violation " ) {
400+ }
401+ elseif ($ val === "Protocol Violation " ){
410402 $ this ->tpl_data ['join_tbl ' ] = "mri_violations_log " ;
411- } else {
403+ }
404+ else {
412405 $ this ->tpl_data ['join_tbl ' ] = "MRICandidateErrors " ;
413406 }
414407 }
415408 if ($ key === 'SeriesUID ' ) {
416409 $ this ->tpl_data ['items ' ][$ x ]['series ' ] = $ val ;
417- } else {
410+ }
411+ else {
418412 $ this ->tpl_data ['items ' ][$ x ][$ i ]['name ' ] = $ key ;
419413 $ this ->tpl_data ['items ' ][$ x ][$ i ]['value ' ] = $ val ;
420414 }
0 commit comments