$user =& User::singleton($_SESSION['State']->getUsername()); if (PEAR::isError($user)) { die("Error creating user object: " . $user->getMessage()); } // check permissions if ($user->hasPermission('imaging_browser_qc')) { $tpl_data['has_permission'] = true; } // instantiate feedback mri object $comments = new FeedbackMRI($_REQUEST['fileID'], $_REQUEST['sessionID']); /* * UPDATE SECTION */ if ($_POST['fire_away'] && $user->hasPermission('imaging_browser_qc')) { // clear all predefined comments $comments->clearAllComments(); // set selected predefined comments $comments->setPredefinedComments($_POST['savecomments']['predefined']); // save all textual comments but only if there is an entry [sebas] foreach ($_POST['savecomments']['text'] as $comment_type_id => $comment_message) { if (trim($comment_message)) { $comments->addTextComment(trim($comment_message), $comment_type_id); } } // save all comment status fields if (is_array($_POST['saveCommentStatusField'])) { foreach ($_POST['saveCommentStatusField'] as $status_field => $value) { $comments->setMRIValue($status_field, $value); } } }