// ContentForm // ----------------------------------------------------------------------------------------------- // MAIN CONTENT // New project object to work with.. $project = new qa_project($project_id); // Administrator status.. $have_admin = $project->qa_process->have_admin; // Viewing approvals history? if (!isset($view_history)) { $view_history = "no"; } // --------------------------------------------------------------------- // Make sure we have a valid QA step.. if (!isset($qastep)) { if (isset($project_id) && isset($step_id)) { $qastep = new qa_project_step(); $qastep->get($project_id, $step_id); if (!$qastep->valid) { unset($qastep); } } } $s = ""; if (isset($qastep)) { // PROCESS POSTED UPDATES.. if (isset($submit) && $submit == "Update") { if ($project->request_id > 0) { // Possible approval type updates.. if ($project->POSTprocess_approval_updates($qastep->qa_step_id)) { $project->get_project(); }
/** * Render this QA process as an HTML table containing maintenance * widgets which allow the various possible QA steps to be enabled or * disabled for this QA process. */ function QAPlan() { // Determine what status the QA Plan is in. It can be un-approved, // seeking approval, or approved. // NB: The step id for the QA Plan is always '1'.. $qaplan_status = qa_approval_status($this->overall_approval_status(STEP_ID_QAPLAN)); if ($qaplan_status == "") { $qaplan_status = "Unapproved"; } // For display of the approval status of this QA Plan.. $thisplan = "This Quality Assurance Plan is"; switch ($qaplan_status) { case "Approved": $qaplan_status_display = "<span style=\"color:green;font-size:12pt\">{$thisplan} Approved</span>"; break; case "Unapproved": $qaplan_status_display = "<span style=\"color:red;font-size:12pt\">{$thisplan} Not Yet Approved</span>"; break; default: $qaplan_status_display = "<span style=\"color:orange;font-size:12pt\">{$thisplan} Currently Seeking Approval</span>"; } // switch // Main QA Plan table.. $s = ""; $s .= "<table cellspacing=\"2\" cellpadding=\"0\" width=\"100%\">\n"; $s .= "<tr>"; $s .= "<td align=\"center\" colspan=\"2\">{$qaplan_status_display}</td>"; $s .= "</tr>\n"; $s .= "<tr><td height=\"15\" colspan=\"2\"> </td></tr>\n"; $s .= "<tr>"; $s .= "<th style=\"text-align:left;font-weight:bold;border-bottom:solid black 1px;padding-left:3px\">Step</th>\n"; $s .= "<th valign=\"top\">"; $s .= " <table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">"; $s .= " <tr>"; $s .= " <th width=\"80%\" style=\"text-align:left;font-weight:bold;border-bottom:solid black 1px\">Approval type</th>\n"; $s .= " <th width=\"20%\" style=\"text-align:center;font-weight:bold;border-bottom:solid black 1px\">Reqd.</th>\n"; $s .= " </tr>\n"; $s .= " </table>\n"; $s .= "</th>\n"; $s .= "</tr>\n"; $rowclass = "row1"; $last_phase = ""; // We have to do ALL QA steps possible.. $q = "SELECT * FROM qa_step s, qa_phase p"; $q .= " WHERE p.qa_phase=s.qa_phase"; $q .= " ORDER BY qa_phase_order, qa_step_order"; $qry = new PgQuery($q); if ($qry->Exec("qa_process::configuration") && $qry->rows > 0) { while ($row = $qry->Fetch(true)) { $phase = $row["qa_phase_desc"]; $qa_step_id = $row["qa_step_id"]; if (isset($this->qa_steps[$qa_step_id])) { // This step is part of our QA process.. $qastep = $this->qa_steps[$qa_step_id]; $qastep->get_approvals(); $step_required = true; } else { if ($qaplan_status != "Unapproved") { // Unless the QA Plan is un-approved, don't even bother listing the // steps that aren't involved in it.. continue; } else { // Create a place-holder QA step.. $qastep = new qa_project_step($this->project_id, 0, $row); $step_required = false; } } // Row styling - required steps are dark.. $rowclass = $step_required ? "row1" : "row0"; if ($phase != $last_phase) { $s .= "<tr class=\"cols\">"; $s .= "<td colspan=\"2\" height=\"20\" valign=\"bottom\" style=\"font-weight:bold;color:white;padding-left:3px\">" . strtoupper($phase) . " PHASE</td>"; $s .= "</tr>\n"; $last_phase = $phase; } $s .= "<tr class=\"{$rowclass}\">"; // Step description $step_desc = $qastep->qa_step_desc; if ($step_required) { // Bold the step description.. $step_desc = "<b>{$step_desc}</b>"; } // Clickable action links.. $acts = array(); // Snapshot statuses of this step.. $overall_step_status = $qastep->overall_approval_status(); $step_status = qa_status_coloured($overall_step_status); // Friendlier overall step status.. $overall_step_status = qa_approval_status($overall_step_status); if ($overall_step_status == "") { $overall_step_status = "Unapproved"; } if ($step_required) { if ($overall_step_status != "Unapproved") { $acts[] = $step_status; } if ($this->have_admin) { // Step detail link.. $href = "/qams-step-detail.php"; $href .= "?project_id={$qastep->project_id}"; $href .= "&step_id={$qastep->qa_step_id}"; $label = "[detail]"; $title = "Go to the detail screen for this QA step"; $link = "<a href=\"{$href}\" title=\"{$title}\">{$label}</a>"; // Step description.. $step_desc = "<b>{$step_desc}</b>  " . $link; // Only have actions if not fully approved.. if ($overall_step_status != "Approved") { // Assignment action link.. $assignment = $qastep->assigned(); $href = "/qams-step-detail.php"; $href .= "?project_id={$qastep->project_id}"; $href .= "&step_id={$qastep->qa_step_id}"; if ($assignment === false) { $label = "Assign to"; $title = "Assign responsibility for this QA step to someone"; $link = "<a href=\"{$href}\" title=\"{$title}\">{$label}</a>"; $acts[] = $link; } else { $fullname = $assignment["fullname"]; $label = "Re-assign from"; $title = "Re-assign responsibility for this QA step"; $link = "<a href=\"{$href}\" title=\"{$title}\">{$label}</a>"; $acts[] = "{$link} {$fullname}"; } // Seek action link.. $href = "/qams-request-approval.php"; $href .= "?project_id={$qastep->project_id}"; $href .= "&step_id={$qastep->qa_step_id}"; $label = "Seek approval"; $title = "Seek approval for this QA step from someone"; $link = "<a href=\"{$href}\" title=\"{$title}\">{$label}</a>"; $acts[] = $link; // Remove action link.. if ($qastep->mandatory) { $acts[] = "(mandatory)"; } else { // Can't remove if Plan is approved.. if ($qaplan_status == "Unapproved") { $remchk = "<input type=\"checkbox\"" . " name=\"step_removals[]\"" . " title=\"Tag this step for removal from the QA process\"" . " value=\"{$qastep->qa_step_id}\"" . ">"; $acts[] = $remchk . " Remove"; } } } else { // Allow for this step to be modified and then re-approved $href = "{$REQUEST_URI}"; $href .= "?request_id={$qastep->project_id}"; $href .= "&step_id={$qastep->qa_step_id}"; $href .= "&qa_action=reapprove"; $label = "Re-approve"; $title = "Click if this step needs to be changed, and then re-approved"; $link = "<a href=\"{$href}\" title=\"{$title}\">{$label}</a>"; $acts[] = $link; } } } else { if ($qaplan_status == "Unapproved") { // Add action link.. $addchk = "<input type=\"checkbox\"" . " name=\"step_additions[]\"" . " title=\"Tag this step for adding to the QA process\"" . " value=\"{$qastep->qa_step_id}\"" . ">"; $acts[] = $addchk . " Add"; } } // Render the description and any action links.. $allacts = implode("<br> ", $acts); if ($allacts != "") { $step_desc .= "<br> " . $allacts; } $s .= "<td width=\"50%\" valign=\"top\" style=\"padding-left:3px\">{$step_desc}</td>"; // Approvals lists.. if ($step_required) { $s .= "<td width=\"50%\" valign=\"top\">"; $s .= $qastep->render_approval_types($this->have_admin && $qaplan_status == "Unapproved"); $s .= "<br></td>"; } else { $s .= "<td width=\"50%\"> </td>"; } $s .= "</tr>\n"; // Special notes.. if ($step_required) { if ($this->have_admin && $qaplan_status == "Unapproved") { $F = "<textarea name=\"special_notes_" . $qastep->qa_step_id . "\" style=\"width:550px;height:65px\">"; $F .= $qastep->special_notes; $F .= "</textarea>"; $s .= "<tr class=\"{$rowclass}\">"; $s .= "<td align=\"center\" valign=\"top\" colspan=\"2\" style=\"padding-bottom:3px\">"; $s .= "<table cellspacing=\"2\" cellpadding=\"0\" width=\"100%\" align=\"center\">\n"; $s .= "<tr>"; $s .= "<td width=\"20%\" align=\"right\" valign=\"top\">Special notes:</td>"; $s .= "<td width=\"80%\" valign=\"top\">" . $F . "</td>"; $s .= "</tr>\n"; $s .= "</table>\n"; $s .= "</td></tr>\n"; } elseif ($qastep->special_notes != "") { $s .= "<tr class=\"{$rowclass}\">"; $s .= "<td> </td>"; $s .= "<td style=\"padding-right:10px\">"; $s .= "<p><b>Note:</b> " . $qastep->special_notes . "</p>"; $s .= "</td>"; $s .= "</td></tr>\n"; } $s .= "<tr><td style=\"border-top:solid grey 1px;\" colspan=\"2\" height=\"6\"> </td></tr>\n"; } } // while } $s .= "</table>\n"; return $s; }