$qparams = array('SID' => $comments->sessionID); } $result = $DB->pselect($query, $qparams); if (PEAR::isError($result)) { $tpl_data['error_message'][] = $result->getMessage(); } if (count($result) > 0) { $i = 0; foreach ($result[0] as $key => $value) { $tpl_data['identifier'][$i]['name'] = str_replace('_', ' ', $key); $tpl_data['identifier'][$i]['value'] = $value; $i++; } } // get the list of comment types $comment_types = $comments->getAllCommentTypes(); // loop through the comment types $i = 0; foreach ($comment_types as $comment_type_id => $comment_array) { $CommentTpl =& $tpl_data['comment'][$i]; // print the status select field if it exists if (!empty($comment_array['field']) && $comments->objectType == 'volume') { if ($user->hasPermission('imaging_browser_qc')) { $CommentTpl['select_name'] = $comment_array['field']; $CommentTpl['select_value_array'] = $comment_array['values']; } $CommentTpl['selected'] = $comments->getMRIValue($comment_array['field']); } $CommentTpl['name'] = $comment_array['name']; // get the list of predefined comments for the current type $predefined_comments = $comments->getAllPredefinedComments($comment_type_id);
/** * Builds data dictionary for given scan types * * @param array $types list of scan types * * @return void */ private function _buildDataDictionary($types) { $this->Dictionary = array('QCComment' => array('Type' => 'varchar(255)', 'Description' => 'QC Comment for Session')); /* creating dummy mri feedback object so all the mri feedback * types can be added to the dictionary */ $mri_feedback = new FeedbackMRI(1, ""); foreach ($types as $type) { $ScanType = $type['ScanType']; $SelectedArray = array('Type' => 'varchar(255)', 'Description' => "Selected {$ScanType} file for session", 'IsFile' => true); $QCStatusArray = array('Type' => "enum('Pass', 'Fail')", 'Description' => "QC Status for {$ScanType} file"); $this->Dictionary["Selected_{$ScanType}"] = $SelectedArray; $this->Dictionary[$ScanType . "_QCStatus"] = $QCStatusArray; $feedback_types = $mri_feedback->getAllCommentTypes(); foreach ($feedback_types as $CommentTypeID => $comments) { if (!empty($comments['field'])) { $fieldName = $comments['field']; $type = "enum ('" . implode("','", $comments['values']) . "')"; $cmt_field = "Comment_" . $fieldName . "_{$ScanType}"; $scanfield = "{$fieldName} {$ScanType}"; $cmt_Array = array('Type' => 'varchar(255)', 'Description' => "Overall Comment for {$scanfield}"); $this->Dictionary[$cmt_field] = $cmt_Array; } else { $fieldName = $comments['name']; $type = 'varchar(255)'; } $this->feedback_Comments[$CommentTypeID] = $fieldName; $cmt_scanArray = array('Type' => $type, 'Description' => $comments['name'] . " {$ScanType}"); $this->Dictionary[$fieldName . "_{$ScanType}"] = $cmt_scanArray; $preDefinedComments = $mri_feedback->getAllPredefinedComments($CommentTypeID); $this->feedback_PreDefinedComments[$CommentTypeID] = array(); $pre = array(); foreach ($preDefinedComments as $preDefinedCommentTypeID => $preDefinedComment) { $preDef_field = $preDefinedComment['field'] . "_{$ScanType}"; $preDef_cmt = $preDefinedComment['Comment']; $preDef_Array = array('Type' => "enum('Yes', 'No')", 'Description' => "{$preDef_cmt} {$ScanType}"); $this->Dictionary[$preDef_field] = $preDef_Array; $pre[$preDefinedCommentTypeID] = $preDefinedComment['field']; } $this->feedback_PreDefinedComments[$CommentTypeID] = $pre; } $mri_array = array('ScannerID' => 'Scanner ID', 'Pipeline' => 'Pipeline', 'OutputType' => 'Output Type', 'AcquisitionProtocol' => 'Protocol', 'CoordinateSpace' => 'Space', 'Algorithm' => 'Algorithm', 'AcquisitionDate' => 'Acquisition Date', 'FileInsertDate' => 'Insert date', 'SeriesDescription' => 'Series Description', 'SeriesNumber' => 'Series Number', 'EchoTime' => 'Echo Time', 'RepetitionTime' => 'Repetition Time', 'SliceThickness' => 'Slice Thickness', 'Time' => 'No of volumes', 'Comment' => 'Comment', 'SlicewiseRejected' => 'Slicewise correlations (Nb)', 'InterlaceRejected' => 'Interlace correlations (Nb)', 'IntergradientReject' => 'Gradient-wise correlations (Nb)', 'TotalRejected' => 'No. of rejected directions', 'Caveat' => 'Caveat', 'ProcessingPipeline' => 'Processing Pipleline'); $this->mri_header_fields = $mri_array; foreach ($this->mri_header_fields as $field => $desc) { $mri_field = $field . "_{$ScanType}"; $this->Dictionary[$mri_field] = array('Type' => "varchar(255)", 'Description' => $desc . " {$ScanType}"); } } }