5 * @version $Id: PhpdocHTMLModuleRenderer.php,v 1.4 2000/12/03 22:37:37 uw Exp $
\r
7 class PhpdocHTMLModuleRenderer extends PhpdocHTMLDocumentRenderer {
\r
10 * Sets the xml and template root directory.
\r
12 * @param string XML file path
\r
13 * @param string Template file path
\r
14 * @param string Name of the current application
\r
15 * @param string Filename extension
\r
16 * @see setPath(), setTemplateRoot()
\r
18 function PhpdocHTMLModuleRenderer($path, $templateRoot, $application, $extension = ".html") {
\r
20 $this->setPath($path);
\r
21 $this->setTemplateRoot($templateRoot);
\r
22 $this->application = $application;
\r
23 $this->file_extension = $extension;
\r
25 $this->accessor = new PhpdocModuleAccessor;
\r
26 $this->tpl = new IntegratedTemplate($this->templateRoot);
\r
27 $this->fileHandler = new PhpdocFileHandler;
\r
29 } // end constructor
\r
34 * @param string XML source file
\r
35 * @param string Name of the HTML target file.
\r
38 function renderModule($xmlfile, $htmlfile = "") {
\r
40 $this->tpl->loadTemplatefile("module.html");
\r
41 if ("" == $htmlfile)
\r
42 $htmlfile = substr($xmlfile, 7, -4) . $this->file_extension;
\r
44 $this->accessor->loadXMLFile($this->path . $xmlfile);
\r
45 $module = $this->accessor->getModuledata();
\r
47 $this->renderFunctions();
\r
48 $this->renderUses();
\r
49 $this->renderConstants();
\r
52 $tplvars["MODULE_FILE"] = $module["file"]["value"];
\r
53 $tplvars["MODULE_NAME"] = $module["name"];
\r
54 $tplvars["MODULE_GROUP"] = $module["group"];
\r
55 $tplvars["MODULE_ACCESS"] = $module["access"];
\r
56 $tplvars["MODULE_PACKAGE"] = $module["package"];
\r
57 $tplvars["MODULE_UNDOC"] = ("true" == $module["undoc"]) ? $this->undocumented : "";
\r
59 if (isset($module["doc"]["link"]))
\r
60 $this->renderLinks($module["doc"]["link"], "class_");
\r
62 if (isset($module["doc"]["author"]))
\r
63 $this->renderAuthors($module["doc"]["author"], "class_");
\r
65 if (isset($module["doc"]["see"]))
\r
66 $this->renderSee($module["doc"]["see"], "class_");
\r
68 $fields = array( "version", "deprecated", "copyright", "since", "magic");
\r
70 while (list($k, $field) = each($fields))
\r
72 if (isset($module["doc"][$field])) {
\r
73 $this->tpl->setCurrentBlock("module_" . strtolower($field));
\r
74 $this->tpl->setVariable(strtoupper($field), $module["doc"][$field]["value"]);
\r
75 $this->tpl->parseCurrentBlock();
\r
78 $fields = array( "description", "shortdescription" );
\r
80 while (list($k, $field) = each($fields))
\r
82 if (isset($module["doc"][$field]))
\r
83 $tplvars["MODULE_" . strtoupper($field)] = $this->encode($module["doc"][$field]["value"]);
\r
85 $this->tpl->setCurrentBlock("__global__");
\r
86 $this->tpl->setVariable($tplvars);
\r
87 $this->tpl->setVariable("APPNAME", $this->application);
\r
89 $this->fileHandler->createFile($this->path . $htmlfile, $this->tpl->get() );
\r
90 $this->tpl->free();
\r
92 } // end func renderModule
\r
94 } // end class PhpdocHTMLModuleRenderer
\r