예제 #1
0
        $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);
    // loop through the predefined comments
    $j = 0;
    foreach ($predefined_comments as $predefined_comment_id => $predefined_comment_text) {
        $PredefinedTpl =& $CommentTpl['predefined'][$j];
        // print a form element
        $PredefinedTpl['id'] = $predefined_comment_id;
        $PredefinedTpl['predefined_text'] = $predefined_comment_text['Comment'];
        // print the comment text
        $Saved = $saved_comments[$comment_type_id];
        if ($Saved['predefined'][$predefined_comment_id]) {
            $CommentTpl['predefined'][$j]['checked'] = true;
 /**
  * Add saved mri feedback to each of the selected scan
  *
  * @param array       $current_feedback Saved feedback for a particular
  *                                      scan
  * @param array       $scan_type        All selected scan types in the
  *                                      database
  * @param FeedbackMRI $mri_feedback     feedback object
  *
  * @return array $CandidateData Array of feedback and value for a particular
  *                              scan
  */
 function _addMRIFeedback($current_feedback, $scan_type, $mri_feedback)
 {
     $CandidateData = array();
     //setting default values for mri feedback
     foreach ($this->feedback_Comments as $CommentTypeID => $field) {
         $CandidateData[$field . "_" . $scan_type] = $mri_feedback->getMRIValue($field);
         // overall comment field for each CommentTypeID
         $CandidateData["Comment_" . $field . "_" . $scan_type] = '';
         // set deafault for all the predefined comments as well
         $predefn = $this->feedback_PreDefinedComments[$CommentTypeID];
         foreach ($predefn as $id => $key) {
             $CandidateData[$key . "_" . $scan_type] = 'No';
             //no is default
         }
     }
     foreach ($current_feedback as $CommentTypeID => $comment) {
         if (array_key_exists("predefined", $comment)) {
             $predefined = $comment['predefined'];
             foreach ($predefined as $key => $val) {
                 $field_set = $this->feedback_PreDefinedComments[$CommentTypeID][$key];
                 $CandidateData[$field_set . "_" . $scan_type] = 'Yes';
             }
         }
         if (array_key_exists("text", $comment)) {
             $field_set = "Comment_" . $this->feedback_Comments[$CommentTypeID];
             $CandidateData[$field_set . "_" . $scan_type] = $comment['text'];
         }
     }
     return $CandidateData;
 }