function get_reviews($id) { // Subtract 1000 from id $id = $id - 1000; // Open the database connection $db = db_open(); // Get the comments $stmt = $db->prepare("SELECT * FROM mgmt_reviews WHERE risk_id=:risk_id ORDER BY submission_date DESC"); $stmt->bindParam(":risk_id", $id, PDO::PARAM_INT); $stmt->execute(); // Store the list in the array $reviews = $stmt->fetchAll(); // Close the database connection db_close($db); foreach ($reviews as $review) { $date = htmlentities(date('Y-m-d g:i A T', strtotime($review['submission_date']))); $reviewer = get_name_by_value("user", $review['reviewer']); $review_value = get_name_by_value("review", $review['review']); $next_step = get_name_by_value("next_step", $review['next_step']); $comment = htmlentities(stripslashes($review['comments'])); echo "<p>\n"; echo "<u>" . $date . "</u><br />\n"; echo "Reviewer: " . $reviewer . "<br />\n"; echo "Review: " . $review_value . "<br />\n"; echo "Next Step: " . $next_step . "<br />\n"; echo "Comment: " . $comment . "\n"; echo "</p>\n"; } return true; }
</div> <div class="span4"> <div class="well"> <h4>Last Review</h4> <?php echo "Review Date: \n"; echo "<input type=\"text\" name=\"review_date\" id=\"review_date\" size=\"50\" value=\"" . $review_date . "\" disabled=\"disabled\" />\n"; echo "<br />\n"; echo "Reviewer: \n"; echo "<input type=\"text\" name=\"reviewer\" id=\"reviewer\" size=\"50\" value=\"" . get_name_by_value("user", $reviewer) . "\" disabled=\"disabled\" />\n"; echo "<br />\n"; echo "Review: \n"; echo "<input type=\"text\" name=\"review\" id=\"review\" size=\"50\" value=\"" . get_name_by_value("review", $review) . "\" disabled=\"disabled\" />\n"; echo "<br />\n"; echo "Next Step: \n"; echo "<input type=\"text\" name=\"next_step\" id=\"next_step\" size=\"50\" value=\"" . get_name_by_value("next_step", $next_step) . "\" disabled=\"disabled\" />\n"; echo "<br />\n"; echo "<label>Comments</label>\n"; echo "<textarea name=\"comments\" cols=\"50\" rows=\"3\" id=\"comments\" disabled=\"disabled\">" . $comments . "</textarea>\n"; echo "<p><a href=\"/management/reviews.php?id=" . $id . "\">View All Reviews</a></p>"; ?> </div> </div> </form> </div> <div class="row-fluid"> <div class="well"> <h4>Comments</h4> <?php get_comments($id); ?>