4f8c2264211b7b28695e57b058c37a2434304447
[atutor.git] / mods / phpdoc / PHPDoc / renderer / html / PhpdocHTMLRendererManager.php
1 <?php
2 /**
3 * Controls the HTML Renderer objects.
4
5 */ 
6 class PhpdocHTMLRendererManager extends PhpdocObject {
7
8         /**
9         * @var  object PhpdocHTMLIndexRenderer
10         */
11         var $indexrenderer;
12
13         /**
14         * @var  object PhpdocHTMLClassRenderer
15         */
16         var $classrenderer;
17
18         /**
19         * @var  object PhpdocHTMLModuleRenderer
20         */
21         var $modulerenderer;
22
23         /**
24         * @var  object PhpdocHTMLWarningRenderer
25         */
26         var $warningrenderer;
27
28         /**
29         * Creates all necessary renderer objects
30         * 
31         * @param        string  Name of the target directory
32         * @param        string  Name of the directory with the templates.
33         * @param        string  Name of the current application
34         * @param        string  Extension of generated files
35         */      
36         function PhpdocHTMLRendererManager($target, $template, $application, $extension = ".html") {
37
38                 $this->indexrenderer = new PhpdocHTMLIndexRenderer($target, $template, $application, $extension);
39                 $this->indexrenderer->generate();
40
41                 $this->classrenderer    = new PhpdocHTMLClassRenderer($target, $template, $application, $extension);
42                 $this->modulerenderer = new PhpdocHTMLModuleRenderer($target, $template, $application, $extension);
43                 $this->warningrenderer = new PhpdocHTMLWarningRenderer($target, $template, $application, $extension);
44
45         } // end constructor
46
47         /**
48         * Renders the given xml file.
49         * 
50         * @param        string  XML file.
51         * @param        string  Content of the XML file: class, classtree, 
52         *                                                                       module, modulegroup, warnings, indexdata
53         * @access       public
54         */
55         function render($xmlfile, $type) {
56                         
57                 switch (strtolower($type)) {
58                 
59                         case "class":
60                                 $this->classrenderer->renderClass($xmlfile);
61                                 break;
62
63                         case "classtree":
64                                 $this->indexrenderer->addClasstree($xmlfile);
65                                 break;
66
67                         case "module":
68                                 $this->modulerenderer->renderModule($xmlfile);
69                                 break;  
70
71                         case "modulegroup":
72                                 $this->indexrenderer->addModulegroup($xmlfile);
73                                 break;
74
75                         case "warning":
76                                 $this->warningrenderer->addWarnings($xmlfile);
77                                 break;
78
79                 }
80
81         } // end func render
82
83         /**
84         * Finishes the rendering process.
85         * 
86         * Finish means here: write the classtree and modulegroup overview to disk.
87         *
88         * @access       public
89         */      
90         function finish() {
91
92                 $this->indexrenderer->finishClasstree();
93                 $this->indexrenderer->finishModulegroup();
94                 $this->warningrenderer->finishWarnings();
95
96         } // end func finish
97
98 } // end class PhpdocHTMLRendererManager
99 ?>