3 * Renders files with warnings.
5 class PhpdocHTMLWarningRenderer extends PhpdocHTMLRenderer {
8 * Sets the xml and template root directory.
10 * @param string XML file path
11 * @param string Template file path
12 * @param string Name of the application
13 * @param string Filename extension
14 * @see setPath(), setTemplateRoot()
16 function PhpdocHTMLWarningRenderer($path, $templateRoot, $application, $extension = ".html") {
18 $this->setPath($path);
19 $this->setTemplateRoot($templateRoot);
20 $this->application = $application;
21 $this->file_extension = $extension;
23 $this->accessor = new PhpdocWarningAccessor;
24 $this->fileHandler = new PhpdocFileHandler;
29 * Saves the generated report.
34 function finishWarnings() {
36 if (!is_object($this->tpl))
39 $this->tpl->setVariable("APPNAME", $this->application);
40 $this->fileHandler->createFile($this->path."phpdoc_warnings" . $this->file_extension, $this->tpl->get() );
44 } // end func finishWarnings
47 * Adds file with warnings to the warning list.
49 * @param string XML file
50 * @see finishWarnings()
53 function addWarnings($xmlfile) {
55 $data = $this->accessor->getWarnings($this->path . $xmlfile);
56 if (!is_object($this->tpl)) {
57 $this->tpl = new IntegratedTemplate($this->templateRoot);
58 $this->tpl->loadTemplateFile("warnings.html");
62 while (list($file, $warnings) = each($data)) {
64 $this->tpl->setCurrentBlock("warning_loop");
67 while (list($k, $warning) = each($warnings)) {
69 $this->tpl->setVariable("WARNINGTYPE", $warning["type"]);
70 $this->tpl->setVariable("WARNING", $this->encode($warning["value"]));
71 $this->tpl->setVariable("ELEMENT", htmlentities($warning["name"]));
72 $this->tpl->setVariable("ELEMENTTYPE", $warning["elementtype"]);
73 $this->tpl->parseCurrentBlock();
77 $this->tpl->setCurrentBlock("warning");
78 $this->tpl->setVariable("FILE", $file);
79 $this->tpl->setVariable("NUMWARNINGS", count($warnings));
80 $this->tpl->parseCurrentBlock();
85 } // end func addWarnings
87 } // end class PhpdocHTMLIndexRenderer