/** * public * main process of creating file * @param * $title: validated content title (fount in <title> tag); if empty title will not be displayed * $uri: validated content URL (only in case of url input); if empty URL will not be displayed * $problem: problem type on which to create report (can be: known, likely, potential, html, css or all) * $mode: 'guideline' or 'line'; pdf document may have different layout (for known, likely, potential) depending on this var * $_gids: array of guidelines that were used as testing criteria */ public function getPDF($title, $uri, $problem, $mode, $_gids) { // set filename $date = AC_date('%Y-%m-%d'); $time = AC_date('%H-%i-%s'); $filename = 'achecker_' . $date . '_' . $time . $rand_str; $guidelinesDAO = new GuidelinesDAO(); $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids); // get list of guidelines separated by ',' if (is_array($guideline_rows)) { foreach ($guideline_rows as $id => $row) { $guidelines_text .= $row["title"] . ', '; } } $guidelines_text = substr($guidelines_text, 0, -2); // remove ending space and , // print time, date, [resource title,] [resource url,] str with guidelines $this->printInfo($title, $uri, $guidelines_text, $time); // if report by guideline if ($mode == 'guideline') { if ($problem == 'all') { $this->printGuideline('known'); $this->AddPage(); $this->printGuideline('likely'); $this->AddPage(); $this->printGuideline('potential'); if ($this->error_nr_html != -1) { $this->AddPage(); $this->printHTML(); } if ($this->error_nr_css != -1) { $this->AddPage(); $this->printCSS(); } } else { if ($problem == 'html') { $this->printHTML(); } else { if ($problem == 'css') { $this->printCSS(); } else { $this->printGuideline($problem); } } } } else { if ($mode == 'line') { if ($problem == 'all') { $this->printLine('known'); $this->AddPage(); $this->printLine('likely'); $this->AddPage(); $this->printLine('potential'); if ($this->error_nr_html != -1) { $this->AddPage(); $this->printHTML(); } if ($this->error_nr_css != -1) { $this->AddPage(); $this->printCSS(); } } else { if ($problem == 'html') { $this->printHTML(); } else { if ($problem == 'css') { $this->printCSS(); } else { $this->printLine($problem); } } } } } // close and save PDF document $path = AC_EXPORT_RPT_DIR . $filename . '.pdf'; $this->Output($path, 'F'); return $path; }
/** * public * main process of creating file * @param * $title: validated content title (fount in <title> tag); if empty title will not be displayed * $input_content_type: 'file', 'paste' or http://file_path * $problem: problem type on which to create report (can be: known, likely, potential, html, css or all) * $_gids: array of guidelines that were used as testing criteria */ public function getCSV($problem, $input_content_type, $title, $_gids) { // set filename $date = AC_date('%Y-%m-%d'); $time = AC_date('%H-%i-%s'); $filename = 'achecker_' . $date . '_' . $time; $file_content = $this->getInfo($input_content_type, $title, $_gids, $date, $time); if ($problem == 'all') { $file_content .= $this->getResultSection('known'); $file_content .= $this->getResultSection('likely'); $file_content .= $this->getResultSection('potential'); if ($this->error_nr_html != -1) { $file_content .= $this->getHTML(); } if ($this->error_nr_css != -1) { $file_content .= $this->getCSS(); } } else { if ($problem == 'css') { $file_content .= $this->getCSS(); } else { if ($problem == 'html') { $file_content .= $this->getHTML(); } else { $file_content .= $this->getResultSection($problem); } } } $path = AC_EXPORT_RPT_DIR . $filename . '.csv'; $handle = fopen($path, 'w'); fwrite($handle, pack("CCC", 0xef, 0xbb, 0xbf)); fwrite($handle, $file_content); fclose($handle); return $path; }
/** * public * main process of creating file * @param * $problem: problem type on which to create report (can be: known, likely, potential, html, css or all) * $_gids: array of guidelines that were used as testing criteria */ public function getHTMLfile($problem, $_gids, $errors, $user_link_id) { // set filename $date = AC_date('%Y-%m-%d'); $time = AC_date('%H-%i-%s'); $filename = 'achecker_' . $date . '_' . $time; $detail = '<h3>' . _AC("accessibility_review") . '</h3>' . "\n"; if ($problem != 'html' && $problem != 'css') { $this->htmlRpt = new HTMLRpt($errors, $user_link_id); if ($user_link_id != '') { $this->htmlRpt->setAllowSetDecisions('true'); } else { $this->htmlRpt->setAllowSetDecisions('false'); } $this->htmlRpt->generateRpt(); $this->numOfNoDecision = $this->htmlRpt->getNumOfNoDecisions(); } $validation = ''; if ($problem == 'all') { $detail .= $this->getResultSection('known'); $detail .= '<br/>' . $this->getResultSection('likely'); $detail .= '<br/>' . $this->getResultSection('potential'); if ($this->error_nr_html != -1) { $validation .= '<br/>' . $this->getHTML(); } if ($this->error_nr_css != -1) { $validation .= '<br/>' . $this->getCSS(); } } else { if ($problem == 'html') { $validation .= $this->getHTML(); } else { if ($problem == 'css') { $validation .= $this->getCSS(); } else { $detail .= $this->getResultSection($problem); } } } $file_content = str_replace(array('{SUMMARY}', '{GUIDELINE}', '{DETAIL}', '{VALIDATION}'), array($this->getSummaryStr($problem), $this->getGuidelineStr($_gids, $problem), $detail, $validation), $this->html_main); $path = AC_EXPORT_RPT_DIR . $filename . '.html'; $handle = fopen($path, 'w'); fwrite($handle, $file_content); fclose($handle); return $path; }
/** * public * main process of creating file * @param * $title: validated content title (fount in <title> tag); if empty title will not be displayed * $problem: problem type on which to create report (can be: known, likely, potential, html, css or all) * $input_content_type: 'file', 'paste' or http://file_path * $_gids: array of guidelines that were used as testing criteria */ public function getEARL($problem, $input_content_type, $title, $_gids) { // set filename $date = AC_date('%Y-%m-%d'); $time = AC_date('%H-%i-%s'); $filename = 'achecker_' . $date . '_' . $time; $file_content = $this->getAssertorTestSubjectTestCriterionSections($input_content_type, $title, $_gids, $date); $file_content .= '<!-- Test Result --> '; $this->curr_lang = $this->getLangCode(); if ($problem == 'all') { $file_content .= $this->getResultSection('known', $input_content_type); $file_content .= $this->getResultSection('likely', $input_content_type); $file_content .= $this->getResultSection('potential', $input_content_type); if ($this->error_nr_html != -1) { $file_content .= $this->getHTML($input_content_type); } if ($this->error_nr_css != -1) { $file_content .= $this->getCSS(); } } else { if ($problem == 'html') { $file_content .= $this->getHTML($input_content_type); } else { if ($problem == 'css') { $file_content .= $this->getCSS(); } else { $file_content .= $this->getResultSection($problem, $input_content_type); } } } $file_content .= ' </rdf:RDF>'; $path = AC_EXPORT_RPT_DIR . $filename . '.rdf'; $handle = fopen($path, 'w'); fwrite($handle, $file_content); fclose($handle); return $path; }