I'm having a problem trying to work out the best way of doing this. I'm creating a template/review system which allows users to fill in a template and then search on reviews done. Each review is marked on multiple sections which I need to display.
My problem is that I need to list each separate review and it's section in the 'slidingDiv'. Currently this overwrites the $htm variable so each review & it's respective sections is exactly the same when displayed (each done using a different template therefore should be different). I tried using arrays but these were being overwritten. Visually the idea is to have a table which displays each Review and then when they select the Review the 'slidingDiv' shows the Sections of that Review below the Review table.
I realise I'm quite far off the solution but this was the closest I've been getting. Currently I have the below:
if (isset($reviews)) {
include ("templates/default/pheader.php");
echo "<p>Search results displayed below:</p>";
echo "<table id=table-search>";
echo "<tr>";
echo "<th>ECR</th><th>Consultant</th><th>Reviewer</th><th>Template</th><th>Date</th>";
echo "</tr>";
foreach ($reviews as $review) {
$ecr = $review->get_ecr();
$member = $review->get_team_member();
$user = $review->get_user();
$user_name = $user->get_name();
$template = $review->get_template();
$template_name = $template->get_name();
$member_name = $member->get_name();
$timestamp = $review->get_timestamp();
echo "<tr>";
echo "<td>";
echo "<a href=\"#\" class=\"show_hide\">$ecr</a>";
echo "</td>";
echo "<td>";
echo "$member_name";
echo "</td>";
echo "<td>";
echo "$user_name";
echo "</td>";
echo "<td>";
echo "$template_name";
echo "</td>";
echo "<td>";
echo "$timestamp";
echo "</td>";
echo "</tr>";
foreach ($review->get_sections() as $section) {
$section_name = $section->get_name();
$section_total = $section->get_total();
$section_mark = $section->get_mark();
$section_pass = $section->get_pass();
if ($section_pass == 1) {
$section_pass = "<font color = \"green\">PASS</font>";
} else {
$section_pass = "<font color = \"red\">FAIL</font>";
}
$htm .= "<tr><td>$section_name</td>";
$htm .= "<td>$section_total / $section_mark marks</td>";
$htm .= "<td>$section_pass</td></tr>";
}
}
echo "</table>";
echo "<div class=\"slidingDiv\">";
echo "<table>";
//List each section per Review
echo "</table>";
echo "<p><a href=\"#\" class=\"show_hide\">Hide</a></div></p>";
echo "<p><a href=\"search.php\">Search Again</a></p>";
}