// reverse decision if (isset($_POST['reverse'])) { foreach ($_POST['reverse'] as $sequenceID => $garbage) { $decision->makeDecisions(array($sequenceID => AC_NO_DECISION)); } } } } // end of process to made decision // validate referer URIs that has passed validation and received seal. The click on the seal triggers // the if - else below. if ($_GET['uri'] == 'referer') { // validate if the URI from referer matches the URI defined in user_links.user_link_id if (isset($_GET['id'])) { $userLinksDAO = new UserLinksDAO(); $row = $userLinksDAO->getByUserLinkID($_GET['id']); $pos_user_link_uri = strpos($row['URI'], '?'); if ($pos_user_link_URI > 0) { $user_link_uri = substr($row['URI'], 0, $pos_user_link_uri); } else { $user_link_uri = $row['URI']; } $pos_referer_uri = strpos($_SERVER['HTTP_REFERER'], '?'); if ($pos_referer_uri > 0) { $referer_uri = substr($_SERVER['HTTP_REFERER'], 0, $pos_referer_uri); } else { $referer_uri = $_SERVER['HTTP_REFERER']; } // guideline id must be given if the request is to check referer URI if (!isset($_GET['gid'])) { $msg->addError('EMPTY_GID');
/** * set main report * @access private * @param none * @return set main report * @author Cindy Qi Li */ private function setMainStr() { // get $html_main.{SESSIONID} $userLinksDAO = new UserLinksDAO(); $row = $userLinksDAO->getByUserLinkID($this->userLinkID); $sessionID = $row['last_sessionID']; if ($this->numOfErrors > 0) { $detail_error = str_replace(array('{DETAIL_TITLE}', '{DIV_ID}', '{DETAIL}'), array(_AC('errors'), 'errors', $this->htmlRpt->getErrorRpt()), $this->html_detail); } if ($this->numOfLikelyProblems > 0) { $detail_likely = str_replace(array('{DETAIL_TITLE}', '{DIV_ID}', '{DETAIL}'), array(_AC('likely_problems'), 'likely_problems', $this->htmlRpt->getLikelyProblemRpt()), $this->html_detail); } if ($this->numOfPotentialProblems > 0) { $detail_potential = str_replace(array('{DETAIL_TITLE}', '{DIV_ID}', '{DETAIL}'), array(_AC('potential_problems'), 'potential_problems', $this->htmlRpt->getPotentialProblemRpt()), $this->html_detail); } // generate $html_main.{DETAIL} if ($detail_error != '' || $detail_likely != '' || $detail_potential != '') { $detail = '<h3>' . _AC("accessibility_review") . '</h3>' . "\n" . $detail_error . $detail_likely . $detail_potential; } // set display of "make decision" button if ($this->numOfNoDecision > 0) { $button_make_decision = $this->html_button_make_decision; } // set main string $this->mainStr = str_replace(array('{SESSIONID}', '{SUMMARY}', '{GUIDELINE}', '{DETAIL}', '{BUTTON_MAKE_DECISION}'), array($sessionID, $this->summaryStr, $this->guidelineStr, $detail, $button_make_decision), $this->html_main); }
/** * private * main process to generate report in html format */ private function generateRESTRpt() { $num_of_errors = 0; $num_of_likely_problems = 0; $num_of_potential_problems = 0; $checksDAO = new ChecksDAO(); $userDecisionsDAO = new UserDecisionsDAO(); // generate section details foreach ($this->errors as $error) { // generate each error result $result_type = ''; $repair = ''; $decision = ''; $decision_questions = ''; $decision_made = ''; $row_check = $checksDAO->getCheckByID($error["check_id"]); if ($row_check["confidence"] == KNOWN) { // only known errors have <repair> $num_of_errors++; $result_type = _AC('error'); $repair = str_replace('{REPAIR}', htmlentities(_AC($row_check["how_to_repair"])), $this->rest_repair); } else { // generate user's decision. only likely and potential problems have decisions to make $row_userDecision = $userDecisionsDAO->getByUserLinkIDAndLineNumAndColNumAndCheckID($this->userLinkID, $error["line_number"], $error["col_number"], $error['check_id']); if ($row_userDecision['decision'] == AC_DECISION_PASS || $row_userDecision['decision'] == AC_DECISION_FAIL) { if ($row_userDecision['decision'] == AC_DECISION_PASS) { $decision_text = _AC('pass'); } if ($row_userDecision['decision'] == AC_DECISION_FAIL) { $decision_text = _AC('fail'); } $decision_made = str_replace(array('{DECISIONMADE}', '{DECISIONMADEDATE}'), array(htmlentities($decision_text), $row_userDecision['last_update']), $this->rest_decision_made); } if ($row_check["confidence"] == LIKELY) { $result_type = _AC('likely_problem'); if (!$row_userDecision || $row_userDecision['decision'] == AC_DECISION_FAIL) { $num_of_likely_problems++; } } if ($row_check["confidence"] == POTENTIAL) { $result_type = _AC('potential_problem'); if (!$row_userDecision || $row_userDecision['decision'] == AC_DECISION_FAIL) { $num_of_potential_problems++; } } $decision_questions = str_replace(array('{SEQUENCEID}', '{DECISIONPASS}', '{DECISIONFAIL}'), array($error['line_number'] . '_' . $error['col_number'] . '_' . $error['check_id'], htmlentities(_AC($row_check['decision_pass'])), htmlentities(_AC($row_check['decision_fail']))), $this->rest_decision_questions); $decision = $decision_questions . $decision_made; // end of generating user's decision } $result .= str_replace(array('{RESULTTYPE}', '{LINENUM}', '{COLUMNNUM}', '{BASE_HREF}', '{CHECK_ID}', '{TITLE}', '{ERRORMSG}', '{ERRORSOURCECODE}', '{REPAIR}', '{DECISION}'), array($result_type, $error["line_number"], $error["col_number"], htmlentities(AC_BASE_HREF), $error['check_id'], htmlentities(_AC("suggest_improvements")), htmlentities(_AC($row_check['err'])), htmlentities($error["html_code"], ENT_QUOTES, "UTF-8"), $repair, $decision), $this->rest_result); } // retrieve session id $userLinksDAO = new UserLinksDAO(); $row = $userLinksDAO->getByUserLinkID($this->userLinkID); $sessionID = $row['last_sessionID']; // generate guidelines $guidelinesDAO = new GuidelinesDAO(); foreach ($this->guidelineArray as $gid) { $row_guideline = $guidelinesDAO->getGuidelineByIDs($gid); $guidelines .= str_replace('{GUIDELINE}', htmlentities($row_guideline[0]['title']), $this->rest_guideline); } // find out result status: pass, fail, conditional pass if ($num_of_errors > 0) { $status = _AC('fail'); } else { if ($num_of_likely_problems + $num_of_potential_problems > 0) { $status = _AC('conditional_pass'); } else { $status = _AC('pass'); } } // generate final output $this->output = str_replace(array('{STATUS}', '{SESSIONID}', '{NUMOFERRORS}', '{NUMOFLIKELYPROBLEMS}', '{NUMOFPOTENTIALPROBLEMS}', '{GUIDELINES}', '{RESULTS}'), array($status, $sessionID, $num_of_errors, $num_of_likely_problems, $num_of_potential_problems, $guidelines, $result), $this->rest_main); }