function Start($aDBServer, $aProjName) { $dbutils = new DBUtils($aDBServer); $dbutils->SetProject($aProjName); $this->iDirectory = $dbutils->GetProjDir($aProjName); $this->iProjName = $aProjName; $proj = $dbutils->GetProject(); $this->iShowPrivate = $dbutils->GetShowPrivate($aProjName); $this->iDocType = $proj['fld_doctype']; $ds = new DocStat($dbutils); list($avg, $nc, $nm) = $ds->ProjStat($aProjName); $t = '<table width=100% border=1 style="background-color:lightblue;"><tr><td align=center><span style="font-size:20pt;font-family:arial;font-weight:bold;">' . $aProjName . "</span></td></tr></table>\n"; $t .= '<div align=center><h3 style="color:darkred;font-family:arial;">Documentation status: ' . round($avg * 100) . '%</h3>'; $t .= '<span style="font-family:arial;">Total number of Classes: ' . $nc . ', Methods: ' . $nm . "</span><p>\n"; if ($this->iShowPrivate) { $t .= '<i>This version <b>includes</b> private methods & classes</i><p>'; } else { $t .= '<i>This version does <b>not</b> include private methods & classes</i><p>'; } $t .= '<p><i>Generated at ' . strftime('%d %b %Y at %H:%M') . "</i><br>\n"; $t .= "</div><hr>"; $t .= "<p>" . $proj['fld_desc']; if ($this->iDocType == 0) { $dt = 'HTML: Multiple files.'; $this->iWriter->Open($this->iDirectory . 'projinfo.html'); $this->iWriter->W($t); $this->iWriter->Close(); $this->iWriter->Open($this->iDirectory . 'index.html'); $this->iWriter->W($this->iIndexFramePage); $this->iWriter->Close(); } else { $dt = 'HTML: Single file.'; $this->iWriter->Open($this->iDirectory . 'index.html'); $this->iWriter->W($this->iIndexPage); $this->iWriter->W($this->iCSS); $this->iWriter->W($t); } HTMLGenerator::CloseWinButton('left'); echo "<hr>"; echo "<font face=arial><b>Generating reference for project : <font color=blue>{$aProjName}</font></b></font><br>"; echo "Output directory: <b><font color=blue>" . $this->iDirectory . '</font></b><br>'; echo "Output format: <b><font color=blue>{$dt}</font></b> <p>\n"; echo "<hr>"; }
function Run($aProjidx, $aExpandMethods = false, $aCols = 3, $aProjName = '') { $cl = array(); $this->iDBUtils->GetClassListNameKeyPublic($cl); $nc = (count($cl) - 3) / 3; $ds = new DocStat($this->iDBUtils); $total = 0; $ct = array(); $npercol = round($nc / $aCols); $limit = 0; $start = 1; for ($c = 0; $c < $aCols; ++$c) { $limit = $c == $aCols - 1 ? $nc : $limit + $npercol; $t = ''; $marker1 = '<span style="font-family:arial;font-size:110%;font-weight:bold;color:darkblue;">[</span>'; $marker2 = '<span style="font-family:arial;font-size:110%;font-weight:bold;color:darkblue;">]</span>'; for ($i = $start; $i <= $limit; ++$i) { list($cname, $nm, $ma, $tp, $ap) = $ds->ClassStat($cl[3 * $i + 1]); $classpublic = $cl[3 * $i + 2]; $mk1 = ''; $mk2 = ''; if ($classpublic == 0) { $mk1 = $marker1; $mk2 = $marker2; } $p = round(100 * $ap / $tp); $total += $p; $t .= "<tr><td style=\"font-family:arial;font-size:80%;\"><b>{$i}. <font color=red><b>[" . sprintf("%3d", $p) . "%]</b> </font>{$mk1}<a href=\"javascript:openPopup('jpd_editclass.php?key=" . $cl[3 * $i + 1] . "',550,590);\">{$cname}</a>{$mk2}</b></td></tr>\n"; if ($aExpandMethods) { for ($j = 0; $j < $nm; ++$j) { $mk1 = ''; $mk2 = ''; if ($ma[$j][0] == 0) { $mk1 = $marker1; $mk2 = $marker2; } // Adjust the title a little bit to make the columns nicer $l = $j + 1 < 10 ? $j + 1 . ' ' : '' . $j + 1; $t .= "<tr><td style=\"font-family:arial;font-size:80%;\"> {$i}." . $l . ' <font face=courier color=darkred>[' . sprintf("%3d", $ma[$j][3]) . "%]</font> {$mk1}<a href=\"javascript:openPopup('jpd_editmethod.php?key=" . $ma[$j][2] . "',560,670);\">" . $ma[$j][1] . "{$mk2}</a></td></tr>"; } } } $start += $npercol; $ct[] = "<table width=\"100%\" border=0 cellpadding=4>\n{$t}</table>"; } // Get all global functions list($cname, $nm, $ma, $tp, $ap) = $ds->ClassStat(0); $gfuncs = array(); $res = $this->iDBUtils->GetMethodListForClassKey($gfuncs, 0); $n = count($gfuncs) / 2; $gf = ''; if ($n > 0) { $gf = '<p> <table border=0><tr><td style="font-family:arial;font-weight:bold;font-size:90%;">Global functions</td></tr>'; for ($i = 0; $i < $n; ++$i) { $mk1 = ''; $mk2 = ''; if ($ma[$i][0] == 0) { $mk1 = $marker1; $mk2 = $marker2; } $gf .= "<tr><td style=\"font-family:arial;font-size:80%;\"> " . ($i + 1) . ". <a href=\"javascript:openPopup('jpd_editmethod.php?key=" . $ma[$i][2] . "',560,670);\"><font face=courier color=darkred>[" . sprintf("%3d", $ma[$i][3]) . '%] </font>' . $mk1 . $ma[$i][1] . "{$mk2}</a></td></tr>"; } $gf .= '</table>'; } if ($nc > 0) { $avg = round($total / $nc); } else { $avg = 0; } $w = round(100 / $aCols); $t = "<form name='mainform' method=post action=''>"; $t .= "<table border=0 cellspacing=0 width=100%><tr><td style='border-bottom:solid black 1pt;' valign=top>"; $projdoc = $this->iDBUtils->GetProjDir($aProjName) . 'index.html'; $t .= "\n<input name=\"button_gendoc\" type=button value=' Create doc ' onclick=\"openPopup('jpgenhtmldoc.php',400,500,'Update docs');\"> "; $t .= "\n<input name=\"button_opendoc\" type=button value=\" Open doc \" onclick=\"openPopup('{$projdoc}',800,500,'Documentation:{$aProjName}');\">"; $t .= "</td><td style='border-bottom:solid black 1pt;'>\n<input name=\"button_regen\" type=button value=\" Update DB \" onclick=\"openPopup('jpgendbdriver.php?force='+mainform.chkbox_timestamp.checked,500,350,'Update DB');\"> "; $t .= "\n<input name=\"chkbox_timestamp\" type=checkbox value=1> Force "; $t .= "\n</td><td style='border-bottom:solid black 1pt;' valign=top align=right>"; $t .= "<input type=button value=' Close ' onclick='window.close();'>"; $t .= "</td></tr></table></form>"; $t .= "\n<table width=100% cellpadding=5 cellspacing=0 class=projectindex>\n"; $t .= "<tr><td colspan={$aCols} class=projindexheader>{$aProjName}</td></tr>"; $t .= "<tr><td colspan={$aCols} style=\"background:lightgrey;font-family:arial;color:#400080;\">"; $t .= "<b>Documentation status: <span style=\"color:#B01400;\">{$avg} %</span></b> ({$nc} classes)</td></tr>\n"; $tt = '<tr>'; $tt .= "<td width=" . $w . "% valign=top >{$ct['0']}</td>"; for ($i = 1; $i < $aCols; ++$i) { $tt .= "<td width=" . $w . "% valign=top style='border-left: black solid 0.5pt;' >{$ct[$i]}"; if ($i < $aCols - 1) { $tt .= "</td>"; } else { $tt .= "{$gf}</td>"; } } return $t . $tt . '</table>'; }
function Run($aClass, $aFlags = "") { $dbutils = $this->iDBCache->iDBUtils; $dbutils->SetProject($this->iProjname); $proj = $dbutils->GetProject(); $docdir = $proj['fld_docdir']; $showPrivate = $proj['fld_showprivate']; $docType = $proj['fld_doctype']; $showGlobFuncs = $proj['fld_showglobfuncs']; $this->iDBCache->RefreshClasses(); $this->iDBCache->RefreshMethods(); $fmt = $this->NewClassFormatter($this->iDBCache, $aFlags); $fmt->Init($this->iProjname, $proj['fld_desc'], $docType, $docdir, $showPrivate, $showGlobFuncs); $ds = new DocStat($dbutils); list($avg, $nc, $nm) = $ds->ProjStat($this->iProjname); $fmt->InitStat($avg, $nc, $nm); $fmt->Start(); // Format all the classes and their methods $cr = new ClassReader($fmt, $this->iDBCache, $aFlags); $cr->SetNumIndexCols($this->iNumIndexCols); $cr->Run($aClass); // Format all global functions if ($showGlobFuncs) { $gf = new GlobalFuncReader($fmt, $this->iDBCache, $aFlags); $gf->Run(); } $fmt->End(); }