PHP Classes

File: class/ohtml.cls.php

Recommend this page to a friend!
  Classes of Johan Barbier   Class Doc   class/ohtml.cls.php   Download  
File: class/ohtml.cls.php
Role: Class source
Content type: text/plain
Description: html generator class
Class: Class Doc
Generate PHP code documentation in multiple idioms
Author: By
Last change: Some bug corrections
Date: 18 years ago
Size: 25,831 bytes
 

Contents

Class file image Download
<?php /** * CLASS ohtml * classe de rendu html de la documentation de odocclass et odocfunc * auteur : johan <barbier_johan@hotmail.com> * version 10/02/2006 * * free to use, modify, please just tell me if you make any changes :-) */ class ohtml { private $oloc; /** * chaîne contenant le html généré */ private $sHtml= ''; private $package; /** * constantes contenant les répertoires des documentations */ const docClassDir = 'classes'; const docFuncDir = 'fonctions'; const docDir = 'docs'; public function __construct ($package = '') { $this -> oloc = new olocale ($_SESSION['locale']); $this -> package = $package; } /** * méthode publique header * stocke le header de la page html */ public function header () { $this -> sHtml .= <<<EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <link rel="stylesheet" type="text/css" href="../../../../../css/maindoc.css" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h2 class="titre">ClassFuncDoc : <em>{$this -> oloc -> getMsg ('gui', 'app_title')}</em></h2> EOS; } /** * méthode publique headerFunc * stocke le header de la page html pour les fonctions */ public function headerFunc () { $this -> sHtml .= <<<EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <link rel="stylesheet" type="text/css" href="../../../../css/maindoc.css" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h2 class="titre">ClassFuncDoc : <em>{$this -> oloc -> getMsg ('gui', 'app_title')}</em></h2> EOS; } /** * méthode publique footer * stocke le footer de la page html */ public function footer () { $this -> sHtml .= <<<EOS </body> </html> EOS; } /** * méthode publique setMenuFunc * crée le menu html pour les fonctions */ public function setMenuFunc ($fileName, $aFunctions, $file = '') { $this -> sHtml .= <<<EOS <div class="path"> <span class="acc"><a class="acc" href="../../index.html" title="{$this -> oloc -> getMsg ('gui', 'gui_home')}">{$this -> oloc -> getMsg ('gui', 'gui_home')}</a></span><br /><br /> <span><a class="current" href="{$fileName}.html" title="{$fileName}">{$fileName}</a></span> </div> <div class="menu"> EOS; if (!empty ($aFunctions)) { ksort ($aFunctions); $this -> sHtml .= <<<EOS <ul>Fonctions EOS; foreach ($aFunctions as $clef => $val) { if ($file === $clef) { $class = 'class="current"'; } else { $class = 'class="other"'; } $this -> sHtml .= <<<EOS <li><a {$class} href="{$clef}.html" title="$clef">{$clef}</a></li> EOS; } } $this -> sHtml .= <<<EOS </ul> </div> EOS; } /** * méthode publique setMenu * crée le menu html pour les classes */ public function setMenu ($className, $parent, $child, $aMethods, $aProperties, $file = '') { $this -> sHtml .= <<<EOS <div class="path"> <span class="acc"><a class="acc" href="../../../index.html" title="{$this -> oloc -> getMsg ('gui', 'gui_home')}">{$this -> oloc -> getMsg ('gui', 'gui_home')}</a></span> -> <span class="acc"><a class="acc" href="../index.html" title="{$this -> package}">{$this ->package}</a></span><br /><br /> <span><a class="other" href="../{$parent}/class_{$parent}.html" alt="{$parent}">{$parent}</a> -> <a class="current" href="class_{$className}.html" alt="{$className}">{$className}</a> -> EOS; foreach ($child as $childName) { $this -> sHtml .= <<<EOS <a class="other" href="../{$childName}/class_{$childName}.html" alt="{$childName}">{$childName}</a>, EOS; } $this -> sHtml = rtrim ($this -> sHtml, ','); $this -> sHtml .= <<<EOS </span> </div> <div class="menu"> EOS; if (!empty ($aMethods)) { ksort ($aMethods); $this -> sHtml .= <<<EOS <ul>{$this -> oloc -> getMsg ('doc', 'doc_methods')} EOS; foreach ($aMethods as $clef => $val) { if ($file === $clef) { $class = 'class="current"'; } else { $class = 'class="other"'; } $this -> sHtml .= <<<EOS <li><a {$class} href="{$clef}.html" title="$clef">{$clef}</a></li> EOS; } } $this -> sHtml .= <<<EOS </ul> EOS; if (!empty ($aProperties)) { ksort ($aProperties); $this -> sHtml .= <<<EOS <ul>{$this -> oloc -> getMsg ('doc', 'doc_properties')} EOS; foreach ($aProperties as $clef => $val) { if ($file === $clef) { $class = 'class="current"'; } else { $class = 'class="other"'; } $this -> sHtml .= <<<EOS <li><a {$class} href="{$clef}.html" title="$clef">{$clef}</a></li> EOS; } } $this -> sHtml .= <<<EOS </ul> </div> EOS; } /** * méthode publique setContentGeneralFunc * crée le contenu pours le fichiers de fonctions */ public function setContentGeneralFunc ($fileName, $aFunctions) { $filepath = 'fonctions/'.$fileName; $this -> sHtml .= <<<EOS <div class="content"> EOS; $this -> sHtml .= <<<EOS <span class="name">{$fileName}</span><br /><br /> EOS; $sCode = file_get_contents ($filepath); $code = highlight_string ($sCode, true); $this -> sHtml .= <<<EOS <a class="other" href="javascript: void(0);" title="{$this -> oloc -> getMsg ('doc', 'doc_seecode')}" onclick="document.getElementById('code').style.display = (document.getElementById('code').style.display == 'block')?'none':'block';">{$this -> oloc -> getMsg ('doc', 'doc_seecode')}</a><br /> <div class="code" id="code">{$code}</div><br /><br /> EOS; $iNbFuncs = count ($aFunctions); $this -> sHtml .= <<<EOS <span class="owns"> <ul>{$this -> oloc -> getMsg ('doc', 'doc_functions')} <li>{$iNbFuncs}</li> </ul> </span><br /><br /> EOS; $fp = fopen ($filepath, 'r'); $cpt = 0; while (!feof ($fp)) { fgets ($fp); $cpt ++; } fclose ($fp); $aInfos = array ( 'size' => round (filesize ($filepath)/1024, 2), 'lines' => $cpt, ); $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_parameters')}</span><br /> EOS; $this -> sHtml .= <<<EOS <span class="parameters"><em>{$this -> oloc -> getMsg ('doc', 'doc_filesize')} : </em>{$aInfos['size']} Ko</span><br /> <span class="parameters"><em>{$this -> oloc -> getMsg ('doc', 'doc_filelines')} : </em>{$aInfos['lines']}</span><br /> EOS; $this -> sHtml .= <<<EOS <br /> EOS; $this -> sHtml .= <<<EOS </div> EOS; } /** * méthode publique setContentFunctions * crée le contenu pour les fonctions */ public function setContentFunctions (array $aArgs) { $this -> sHtml .= <<<EOS <div class="content"> EOS; if (!empty ($aArgs)) { $this -> sHtml .= <<<EOS <span class="name">{$aArgs['name']}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="definition">{$aArgs['type']} function {$aArgs['name']} ( EOS; $this -> sHtml .= <<<EOS <em class="methodParams"> EOS; foreach ($aArgs['parameters'] as $clef => $val) { $default = (!empty ($val['default']))?' = '.$val['default']:''; $this -> sHtml .= <<<EOS {$val['reference']} {$val['array']} {$val['name']} {$default}, EOS; } if (!empty ($aArgs['parameters'])) { $this -> sHtml = substr ($this -> sHtml, 0, strlen ($this -> sHtml) - 4); } $this -> sHtml .= <<<EOS </em>)</span><br /><br /> EOS; $code = highlight_string ('<?php'."\r\n".$aArgs['code'].' ?>', true); $this -> sHtml .= <<<EOS <span class="file">{$this -> oloc -> getMsg ('doc', 'doc_file_def1')} {$aArgs['file']} {$this -> oloc -> getMsg ('doc', 'doc_file_def2')} {$aArgs['startline']} {$this -> oloc -> getMsg ('doc', 'doc_file_def3')} {$aArgs['endline']}</span><br /><br /> <a class="other" href="javascript: void(0);" title="{$this -> oloc -> getMsg ('doc', 'doc_seecode')}" onclick="document.getElementById('code').style.display = (document.getElementById('code').style.display == 'block')?'none':'block';">{$this -> oloc -> getMsg ('doc', 'doc_seecode')}</a><br /> <div class="code" id="code">{$code}</div><br /><br /> EOS; $returns = ''; foreach ($aArgs['returns'] as $val) { $returns .= '<strong>Returns</strong> <em>'.$val.'</em><br />'; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_returns')}</span><br /> <span class="returns">{$returns}</span><br /><br /> EOS; $params = ''; foreach ($aArgs['params'] as $val) { $params .= '<strong>Param</strong> <em>'.$val.'</em><br />'; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_params')}</span><br /> <span class="params">{$params}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_parameters')}</span><br /> EOS; foreach ($aArgs['parameters'] as $clef => $val) { $default = (!empty ($val['default']))?' = '.$val['default']:''; $this -> sHtml .= <<<EOS <span class="parameters">{$val['reference']} {$val['array']} {$val['name']} {$default} : ({$val['optional']})</span><br /> EOS; } $this -> sHtml .= <<<EOS <br /> EOS; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_returns_ref')}</span><br /> EOS; $this -> sHtml .= <<<EOS <span class="parameters">{$aArgs['returnsref']}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_comments')}</span><br /> <span class="comments">{$aArgs['comments']}</span><br /><br /> EOS; } $this -> sHtml .= <<<EOS </div> EOS; } /** * méthode publique setContentGeneral * crée le contenu pour les objets */ public function setContentGeneral (array $aArgs) { $this -> sHtml .= <<<EOS <div class="content"> EOS; if (!empty ($aArgs)) { $this -> sHtml .= <<<EOS <span class="name">{$aArgs['name']}</span><br /><br /> EOS; $parent = ''; if (!empty ($aArgs['classe'])) { $type = $aArgs['classeType'] === 'interface'?'implements':'extends'; $parent = $type.' <a href="../'.$aArgs['classe'].'/class_'.$aArgs['classe'].'.html" title="'.$aArgs['classe'].'">'.$aArgs['classe'].'</a>'; } $this -> sHtml .= <<<EOS <span class="definition">{$aArgs['type']} {$aArgs['final']} {$aArgs['abstract']} {$aArgs['interface']} {$aArgs['name']} $parent</span><br /><br /> EOS; if (!empty ($aArgs['code'])) { $code = highlight_string ('<?php'."\r\n".$aArgs['code'].' ?>', true); $this -> sHtml .= <<<EOS <span class="file">{$this -> oloc -> getMsg ('doc', 'doc_file_def1')} {$aArgs['file']} {$this -> oloc -> getMsg ('doc', 'doc_file_def2')} {$aArgs['startline']} {$this -> oloc -> getMsg ('doc', 'doc_file_def3')} {$aArgs['endline']}</span><br /><br/> <a class="other" href="javascript: void(0);" title="{$this -> oloc -> getMsg ('doc', 'doc_seecode')}" onclick="document.getElementById('code').style.display = (document.getElementById('code').style.display == 'block')?'none':'block';">{$this -> oloc -> getMsg ('doc', 'doc_seecode')}</a><br /> <div class="code" id="code">{$code}</div><br /><br /> EOS; } $this -> sHtml .= <<<EOS <span class="owns"> <ul>{$this -> oloc -> getMsg ('doc', 'doc_methods')} <li>{$aArgs['total methods']}</li> </ul> <ul>{$this -> oloc -> getMsg ('doc', 'doc_properties')} <li>{$aArgs['total properties']}</li> </ul> </span><br /><br /> EOS; if (!empty ($aArgs['comments'])) { $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_comments')}</span><br /> <span class="comments">{$aArgs['comments']}</span><br /><br /> EOS; } } $this -> sHtml .= <<<EOS </div> EOS; } /** * méthode publique setContentMethods * crée le contenu pour les méthodes */ public function setContentMethods (array $aArgs) { $this -> sHtml .= <<<EOS <div class="content"> EOS; if (!empty ($aArgs)) { $this -> sHtml .= <<<EOS <span class="name">{$aArgs['name']}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="definition">{$aArgs['type']} {$aArgs['final']} {$aArgs['abstract']} {$aArgs['static']} {$aArgs['public']} {$aArgs['private']} {$aArgs['protected']} function {$aArgs['name']} ( EOS; $this -> sHtml .= <<<EOS <em class="methodParams"> EOS; foreach ($aArgs['parameters'] as $clef => $val) { $default = (!empty ($val['default']))?' = '.$val['default']:''; $this -> sHtml .= <<<EOS {$val['reference']} {$val['array']} {$val['name']} {$default}, EOS; } if (!empty ($aArgs['parameters'])) { $this -> sHtml = substr ($this -> sHtml, 0, strlen ($this -> sHtml) - 4); } $this -> sHtml .= <<<EOS </em>) : {$aArgs['constructor']}</span><br /><br /> EOS; if (!empty ($aArgs['code'])) { $code = highlight_string ('<?php'."\r\n".$aArgs['code'].' ?>', true); $this -> sHtml .= <<<EOS <span class="file">{$this -> oloc -> getMsg ('doc', 'doc_file_def1')} {$aArgs['file']} {$this -> oloc -> getMsg ('doc', 'doc_file_def2')} {$aArgs['startline']} {$this -> oloc -> getMsg ('doc', 'doc_file_def3')} {$aArgs['endline']}</span><br /><br /> <a class="other" href="javascript: void(0);" title="{$this -> oloc -> getMsg ('doc', 'doc_seecode')}" onclick="document.getElementById('code').style.display = (document.getElementById('code').style.display == 'block')?'none':'block';">{$this -> oloc -> getMsg ('doc', 'doc_seecode')}</a><br /> <div class="code" id="code">{$code}</div><br /><br /> EOS; } if (!empty ($aArgs['returns'])) { $returns = ''; foreach ($aArgs['returns'] as $val) { $returns .= '<strong>Returns</strong> <em>'.$val.'</em><br />'; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_returns')}</span><br /> <span class="returns">{$returns}</span><br /><br /> EOS; } if (!empty ($aArgs['params'])) { $params = ''; foreach ($aArgs['params'] as $val) { $params .= '<strong>Param</strong> <em>'.$val.'</em><br />'; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_params')}</span><br /> <span class="params">{$params}</span><br /><br /> EOS; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_owner')}</span><br /> <span class="owner"><a href="../{$aArgs['classe']}/class_{$aArgs['classe']}.html" title="{$aArgs['classe']}">{$aArgs['classe']}</a></span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_modifiers')}</span><br /> <span class="modifiers">{$aArgs['modifiers']}</span><br /><br /> EOS; if (!empty ($aArgs['parameters'])) { $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_parameters')}</span><br /> EOS; foreach ($aArgs['parameters'] as $clef => $val) { $default = (!empty ($val['default']))?' = '.$val['default']:''; $this -> sHtml .= <<<EOS <span class="parameters">{$val['reference']} {$val['array']} {$val['name']} {$default} : ({$val['optional']})</span><br /> EOS; } } $this -> sHtml .= <<<EOS <br /> EOS; if (!empty ($aArgs['comments'])) { $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_comments')}</span><br /> <span class="comments">{$aArgs['comments']}</span><br /><br /> EOS; } } $this -> sHtml .= <<<EOS </div> EOS; } /** * méthode publique setContentProperties * crée le contenu pour les propriétés */ public function setContentProperties (array $aArgs) { $this -> sHtml .= <<<EOS <div class="content"> EOS; if (!empty ($aArgs)) { $this -> sHtml .= <<<EOS <span class="name">{$aArgs['name']}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="definition">{$aArgs['static']} {$aArgs['public']} {$aArgs['private']} {$aArgs['protected']} property {$aArgs['name']}</span><br /><br /> EOS; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_owner')}</span><br /> <span class="owner"><a href="../{$aArgs['classe']}/class_{$aArgs['classe']}.html" title="{$aArgs['classe']}">{$aArgs['classe']}</a></span><br /><br /> EOS; if (!empty ($aArgs['code'])) { if (false !== $aArgs['code']) { $code = highlight_string ('<?php'."\r\n".$aArgs['code'].' ?>', true); $this -> sHtml .= <<<EOS <a class="other" href="javascript: void(0);" title="{$this -> oloc -> getMsg ('doc', 'doc_seecode')}" onclick="document.getElementById('code').style.display = (document.getElementById('code').style.display == 'block')?'none':'block';">{$this -> oloc -> getMsg ('doc', 'doc_seecode')}</a><br /> <div class="code" id="code">{$code}</div><br /><br /> EOS; } } if (!empty ($aArgs['defaultvalue'])) { $defaultValue = false !== $aArgs['defaultvalue']?highlight_string ('<?php'."\r\n".$aArgs['defaultvalue'].' ?>', true):''; $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_default_value')}</span><br /> <span class="default">{$aArgs['default']}<br />{$defaultValue}</span><br /><br /> EOS; } $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_modifiers')}</span><br /> <span class="modifiers">{$aArgs['modifiers']}</span><br /><br /> EOS; if (!empty ($aArgs['comments'])) { $this -> sHtml .= <<<EOS <span class="label">{$this -> oloc -> getMsg ('doc', 'doc_comments')}</span><br /> <span class="comments">{$aArgs['comments']}</span><br /><br /> EOS; } } $this -> sHtml .= <<<EOS </div> EOS; } /** * méthode publique magique __toString * retourne le code html de la propriété privée sHtml */ public function __toString () { return htmlentities ($this -> sHtml); } /** * méthode publique toFileClass * crée le fichier html pour les classes */ public function toFileClass ($className, $fileName) { $loc = $this -> oloc -> getLoc (); $fileName = 'class_'.$fileName.'.html'; if (!is_dir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package)) { mkdir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package, 0644); } if (!is_dir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className)) { mkdir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className, 0644); } $fp = fopen (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className.'/'.$fileName, 'w+'); fwrite ($fp, $this -> sHtml); fclose ($fp); } /** * méthode publique toFileMethProps * crée le fichier html pour les méthodes et les propriétés */ public function toFileMethProps ($className, $fileName) { $loc = $this -> oloc -> getLoc (); $fileName .= '.html'; if (!is_dir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package)) { mkdir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package, 0644); } if (!is_dir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className)) { mkdir (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className, 0644); } $fp = fopen (self::docDir.'/'.$loc.'/'.self::docClassDir.'/'.$this -> package.'/'.$className.'/'.$fileName, 'w+'); fwrite ($fp, $this -> sHtml); fclose ($fp); } /** * méthode publique toFileFunc * crée le fichier html pour les fonctions */ public function toFileFunc ($funcName, $fileName) { $loc = $this -> oloc -> getLoc (); $funcName .= '.html'; if (!is_dir (self::docDir.'/'.$loc.'/'.self::docFuncDir.'/'.$fileName)) { mkdir (self::docDir.'/'.$loc.'/'.self::docFuncDir.'/'.$fileName, 0644); } $fp = fopen (self::docDir.'/'.$loc.'/'.self::docFuncDir.'/'.$fileName.'/'.$funcName, 'w+'); fwrite ($fp, $this -> sHtml); fclose ($fp); } /** * méthode publique setIndex * crée le fichier html pour la page d'accueil */ public function setIndex () { $loc = $this -> oloc -> getLoc (); $this -> sHtml .= <<<EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <link rel="stylesheet" type="text/css" href="../../css/maindoc.css" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h2 class="titre">ClassFuncDoc : <em>{$this -> oloc -> getMsg ('gui', 'app_title')}</em></h2> <div class="menudoc"> <div class="clsdoc"> <ul>{$this -> oloc -> getMsg ('gui', 'app_package_list')}<br /><br /> EOS; $aDocs = scandir (self::docDir.'/'.$loc.'/classes'); foreach ($aDocs as $obj) { if ($obj !== '.' && $obj !== '..') { $this -> sHtml .= <<<EOS <li><a class="other" href="classes/{$obj}/index.html" title="{$this -> oloc -> getMsg ('gui', 'app_doc_about')} {$obj}">{$obj}</a></li> EOS; } } $this -> sHtml .= <<<EOS </ul> </div> <div class="funcdoc"> <ul>{$this -> oloc -> getMsg ('gui', 'app_func_list')}<br /><br /> EOS; $aDocs = scandir (self::docDir.'/'.$loc.'/fonctions'); foreach ($aDocs as $func) { if ($func !== '.' && $func !== '..') { $this -> sHtml .= <<<EOS <li><a class="other" href="fonctions/{$func}/{$func}.html" title="{$this -> oloc -> getMsg ('gui', 'app_doc_about')} {$func}">{$func}</a></li> EOS; } } $this -> sHtml .= <<<EOS </ul> </div> </div> </body> </html> EOS; $this -> saveIndex (); } /** * méthode publique setIndexPack * crée le fichier html pour la page d'accueil des packages */ public function setIndexPack ($aChild) { $loc = $this -> oloc -> getLoc (); $this -> sHtml .= <<<EOS <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> <head> <link rel="stylesheet" type="text/css" href="../../../../css/maindoc.css" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <h2 class="titre">ClassFuncDoc : <em>{$this -> oloc -> getMsg ('gui', 'app_title')}</em></h2> <span class="acc"><a class="acc" href="../../index.html" title="{$this -> oloc -> getMsg ('gui', 'gui_home')}">{$this -> oloc -> getMsg ('gui', 'gui_home')}</a></span><br /><br /> <div class="menudoc"> <div class="clsdoc"> <ul>{$this -> oloc -> getMsg ('gui', 'app_class_list')} : {$this -> package}<br /><br /> EOS; $aDone = array (); $aDocs = scandir (self::docDir.'/'.$loc.'/classes/'.$this -> package.'/'); foreach ($aDocs as $obj) { if ($obj !== '.' && $obj !== '..' && $obj !== 'index.html') { if (empty ($aChild[$obj]['parent'])) { $aDone[] = $obj; $this -> sHtml .= <<<EOS <li><a class="other" href="{$obj}/class_{$obj}.html" title="{$this -> oloc -> getMsg ('gui', 'app_doc_about')} {$obj}">{$obj}</a><ul> EOS; $aDone = array_merge ($aDone, $this -> getArbo ($aChild[$obj]['children'], $aChild)); $this -> sHtml .= <<<EOS </ul></li> EOS; } } } $this -> sHtml .= <<<EOS </ul> </div> </div> </body> </html> EOS; $this -> saveIndexPack (); } /** * méthode privée getArbo * crée le diagramme d'héritage d'un package, méthode récursive * @Params array aTab : tableau des classes enfants * @Params array aChild : tableau complet de la hiérarchie des classes du package */ private function getArbo ($aTab, $aChild) { $aDone = array (); foreach ($aTab as $child) { $aDone[] = $child; $this -> sHtml .= <<<EOS <li><a class="other" href="{$child}/class_{$child}.html" title="{$this -> oloc -> getMsg ('gui', 'app_doc_about')} {$child}">{$child}</a> EOS; if (!empty ($aChild[$child]['children'])) { $this -> sHtml .= <<<EOS <ul> EOS; $aDone = array_merge ($aDone, $this -> getArbo ($aChild[$child]['children'], $aChild)); $this -> sHtml .= <<<EOS </ul> EOS; } $this -> sHtml .= <<<EOS </li> EOS; } return $aDone; } /** * méthode privée saveIndex * enregistre la page d'accueil */ private function saveIndex () { $loc = $this -> oloc -> getLoc (); $fp = fopen (self::docDir.'/'.$loc.'/index.html', 'w+'); fwrite ($fp, $this -> sHtml); fclose ($fp); } /** * méthode privée saveIndexPack * enregistre la page d'accueil */ private function saveIndexPack () { $loc = $this -> oloc -> getLoc (); $fp = fopen (self::docDir.'/'.$loc.'/classes/'.$this -> package.'/index.html', 'w+'); fwrite ($fp, $this -> sHtml); fclose ($fp); } /** * méthode publique magique __destruct * vide la propriété privée sHtml */ public function freeHtml () { $this -> sHtml = ''; } } ?>