Initial Commit

This commit is contained in:
Riley Schneider
2025-12-03 16:38:10 +01:00
parent c5e26bf594
commit b732d8d4b5
17680 changed files with 5977495 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -0,0 +1,385 @@
html {
font-size: 62.5%
}
body {
background-color: #fff;
color: #000;
margin: 3px 8px 3px 3px;
padding: 0px;
font: 100% Arial, Verdana, Helvetica, sans-serif;
font-size: 1em;
}
/**
* Right panel
*/
h1 {
font-size:1.8em;
background-repeat:no-repeat;
background-position:top left;
padding:0px 0px 5px 28px;
margin:5px 0px 0px 0px;
width:360px;
border-width:0px 0px 1px 0px;
border-style:solid;
border-color:#ccc;
}
h1.class {
background-image: url(class-big.png);
border-color:#1515ff;
}
h1.datatype {
background-image: url(datatype-big.png);
border-color:#1515ff;
}
h1.interface {
background-image: url(interface-big.png);
border-color:#1515ff;
}
h1.model {
background-image: url(model-big.png);
border-color:#005b00;
}
h1.package {
background-image: url(package-big.png);
border-color:#005b00;
}
h1.index {
background-image: url(index-all-big.png);
margin:5px 0px 20px 0px;
}
h1.help {
background-image: url(help-big.png);
margin:5px 0px 20px 0px;
}
h2 {
border-width:0px 0px 1px 0px;
border-style:solid;
border-color:#ccc;
width:200px;
color:#000;
margin:15px 0px 8px 0px;
font-size:1.4em;
}
ul, li {
font-size:1em;
}
p {
margin:0px;
padding:3px 0px 3px 0px;
}
ul.summary {
list-style-type:none;
margin:0px;
padding-left:20px;
font-size:1.2em;
line-height:1.5em;
}
ul.summary li {
margin:0px;
padding:0px 0px 1px 0px;
}
ul.summary li.Expanded ul {
border:1px solid #ccc;
background-color:#f5f5f5;
padding:0px 3px 4px 22px;
margin:5px 0px 6px 12px;
}
ul.description {
margin:0px 0px 5px 15px;
padding:0px;
list-style-image:url(point.png);
}
ul.description li {
margin:0px;
padding:0px;
}
ul.single {
margin:5px 0px 5px 0px;
padding:0px;
list-style:none;
}
ul.indexAll {
list-style: none;
line-height:17px;
font-size:1.1em;
}
/**
* Navigation bar
*/
ul.navig {
display: inline;
list-style: none;
margin: 0px;
padding: 5px 1px 0px 0px;
float:right;
}
ul.navig li {
display: inline;
margin: 0px;
padding: 0px 0px 0px 6px;
font-size: 1em;
text-transform: uppercase;
color:#333;
}
ul.navig a {
text-decoration:underline;
}
ul.navig a.right {
background: url(right.png) no-repeat center left;
padding-left:11px;
color:#1515ff;
}
ul.navig a.left {
background: url(left.png) no-repeat center left;
padding-left:11px;
color:#1515ff;
}
ul.navig a.top {
background: url(top.png) no-repeat center left;
padding-left:11px;
color:#005b00;
}
ul.navig a.expandAllBtn {
background: url(expand-all.png) no-repeat center left;
padding:0px 8px 0px 16px;
color:#333;
}
ul.navig a.helpBtn {
background: url(help.png) no-repeat center left;
padding:0px 8px 0px 18px;
color:#333;
}
ul.navig a.indexAllBtn {
background: url(index-all.png) no-repeat center left;
padding:0px 8px 0px 19px;
color:#333;
}
#footer {
padding:20px 0px 5px 0px;
font-style:italic;
position:relative;
bottom:0px;
text-align:right;
color:#505050;
}
/**
* Inheritance diagram
*/
dl.inheritTree {
background-color:#f5f5f5;
padding:3px 6px 3px 6px;
margin:5px 0px 5px 0px;
border:1px solid #ccc;
}
dl.inheritTree dd {
margin: 0px;
padding: 0px;
font-size: 1.1em;
}
dl.inheritTree .current {
font-family:"Courier New", monospace;
font-size:1.1em;
font-weight:bold;
}
div.description {
font-size:1.2em;
padding:0px 3px 0px 6px;
margin:20px 0px 10px 0px;
border:1px solid #ccc;
}
div.descriptionPkg {
font-size:1.2em;
padding:0px;
margin:20px 0px 15px 0px;
}
a {
color:#383838;
background-repeat:no-repeat;
background-position:center left;
text-decoration:none;
}
.model {
color:#005b00;
}
.package {
color:#005b00;
}
.class {
color:#1515ff;
}
.datatype {
color:#1515ff;
}
.interface {
color:#1515ff;
}
.property {
color:#bd7a0e;
}
.method {
color:#80233d;
}
/**
* Left menu
*/
#MainList {
padding:0px 0px 0px 3px;
}
#MainList a {
padding:0px 0px 0px 20px;
}
#MainList a.link, span.link {
padding:0px;
color:#1515ff;
font-family:"Courier New", monospace;
font-size:1em;
}
#MainList a.link2 {
padding:0px;
color:#1515ff;
/*text-decoration:underline;*/
font-family:"Courier New", monospace;
font-size:1em;
}
.title {
font-weight:bold;
color:#222;
letter-spacing:1px;
}
.smallTitle {
font-weight:bold;
color:#222;
}
.defVal, .abstract, .note {
font-style:italic;
}
.note {
font-style:italic;
font-size:0.8em;
}
li.smaller {
font-size:0.9em;
}
a.model {
background-image: url(model.png);
font-weight:bold;
}
a.package {
background-image: url(package.png);
}
a.class {
background-image: url(class.png);
}
a.interface {
background-image: url(interface.png);
font-style:italic;
}
a.datatype {
background-image: url(datatype.png);
}
a.property {
background-image: url(property.png);
}
a.property-pub {
background-image: url(property-pub.png);
color:#bd7a0e;
}
a.property-pro {
background-image: url(property-pro.png);
color:#bd7a0e;
}
a.property-pri {
background-image: url(property-pri.png);
color:#bd7a0e;
}
a.method {
background-image: url(method.png);
}
a.method-pub {
background-image: url(method-pub.png);
color:#80233d;
}
a.method-pro {
background-image: url(method-pro.png);
color:#70233d;
}
a.method-pri {
background-image: url(method-pri.png);
color:#70233d;
}
/**
* Treeview
*/
.TreeView {
display:block;
line-height:18px;
font-size:1.2em;
cursor:pointer;
font-style:normal;
}
.TreeView li {
margin:0px;
padding:0 0 0 16px;
list-style:none;
}
.TreeView, .TreeView ul {
margin:0;
padding:0;
}
.TreeView li.Expanded {
background: url(minus.gif) no-repeat left top;
}
li.Expanded ul {
display: block;
}
.TreeView li.Collapsed {
background: url(plus.gif) no-repeat left top;
}
li.Collapsed ul {
display: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 B

View File

@@ -0,0 +1,165 @@
Array.prototype.indexOf = IndexOf;
//Finds the index of an item in an array
function IndexOf(item) {
for (var i=0; i < this.length; i++) {
if (this[i] == item) {
return i;
}
}
return -1;
}
var toggler = {
//CSS class names
states: Array('Collapsed','Expanded'),
//Caption
statesLib: Array('Collapse', 'Expand'),
//Current state
curState: 1,
//Name of the cookie that stores the current state between pages
cookieName: 'apiTreeviewState',
//Sets all the elements to a new state, and updates the current state variable
toggleAll: function(treeId, btnId)
{
this.curState = 1-this.curState;
this.toggleAllTree(treeId, this.curState)
var btn = document.getElementById(btnId);
btn.innerHTML = this.statesLib[1-this.curState]+' all';
setCookie(this.cookieName, this.curState);
},
//Sets all the elements to a given state
toggleAllTree: function(treeId, stateId)
{
var tree = document.getElementById(treeId);
if(!tree) return;
var treeElements = tree.getElementsByTagName('li');
for (var i=0; i<treeElements.length; i++) {
this.replaceInClass(treeElements[i], this.states[stateId], this.states[1-stateId]);
}
},
//Sets the element to the firstClass given, in place of the second
replaceInClass: function(element, firstClass, secondClass)
{
var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);
if (secondClassIndex>-1) {
classes[secondClassIndex] = firstClass;
}
element.className = classes.join(" ");
},
//Toggles between two classes
toggleClass: function(element, firstClass, secondClass, event)
{
event.cancelBubble = true;
var classes = element.className.split(" ");
var firstClassIndex = classes.indexOf(firstClass);
var secondClassIndex = classes.indexOf(secondClass);
if (firstClassIndex == -1 && secondClassIndex == -1) {
classes[classes.length] = firstClass;
}
else if (firstClassIndex != -1) {
classes[firstClassIndex] = secondClass;
}
else {
classes[secondClassIndex] = firstClass;
}
element.className = classes.join(" ");
},
//Toggle event handler for each expandable/collapsable node
toggleNodeStateHandler: function(event)
{
toggler.toggleClass(this, toggler.states[0], toggler.states[1], (event==null) ? window.event : event);
},
//Prevents the onclick event from bubbling up
preventBubbleHandler: function(event)
{
if (!event)
event = window.event;
event.cancelBubble = true;
},
//Adds the relevant onclick handlers for the nodes in the tree view
setupTreeView: function(treeId)
{
var tree = document.getElementById(treeId);
if(!tree) return;
var treeElements = tree.getElementsByTagName("li");
for (var i=0; i<treeElements.length; i++) {
if (treeElements[i].getElementsByTagName("ul").length>0) {
treeElements[i].onclick = toggler.toggleNodeStateHandler;
}
else {
treeElements[i].onclick = toggler.preventBubbleHandler;
}
}
var h = window.location.hash;
if(h!='') {
var s = document.getElementById(h.substring(1));
if(s) {
this.replaceInClass(s, this.states[1], this.states[0]);
}
}
},
backToMemorizedState: function(treeId, btnId)
{
var x = getCookie(this.cookieName);
if (x==0 || x==1) {
this.curState = x;
var btn = document.getElementById(btnId);
btn.innerHTML = this.statesLib[1-this.curState]+' all';
this.toggleAllTree(treeId, this.curState);
}
}
}
function setCookie(name, value, expires, path, domain, secure)
{
var today = new Date();
today.setTime( today.getTime() );
if (expires) {
expires = expires*1000*60*60*24;
}
var expires_date = new Date(today.getTime() + (expires) );
document.cookie = name + "=" +escape(value) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function getCookie(check_name)
{
var a_all_cookies = document.cookie.split(';');
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false;
for (i=0; i<a_all_cookies.length; i++) {
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if (cookie_name == check_name){
b_cookie_found = true;
if (a_temp_cookie.length>1) {
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if (!b_cookie_found) {
return null;
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the class renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocClass extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'class';
}
protected function getStyleName()
{
return 'class';
}
protected function getPrefix()
{
return self::CLASS_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->classes[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->classes) ? $this->getContextPackage()->classes[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->classes[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,237 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for a classifier (class, interface, datatype)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_HtmlNew_DocClassifier extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Return the type name of the classifier
*
* @return string
*/
abstract protected function getTypeName();
/**
* Return the CSS style name of the classifier
*
* @return string
*/
abstract protected function getStyleName();
/**
* Return the prefix (filename scheme)
*
* @return string
*/
abstract protected function getPrefix();
/**
* Return the current object
*
* @param int $i Current index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getCurrentElement($i);
/**
* Return the next object
*
* @param int $i Current index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getNextElement($i);
/**
* Return the previous object
*
* @param int $i Previous index in all the elements of the package
*
* @return PHP_UML_Metamodel_Classifier
*/
abstract protected function getPreviousElement($i);
/**
* Generates and saves the HTML code for a classifier
*
* @param int $i Index of the element (to be found in the Context object)
*/
public function render($i)
{
$p = $this->getCurrentElement($i);
$nav = $this->getNavigationBlock($i);
$tit = $this->getTitleBlock($i);
$this->ignoredTag = array('var'); // we ignore all 'var' docblocks
$str = $this->getDescriptionBlock($p);
$str .= $this->getPropertyBlock($p);
$str .= $this->getFunctionBlock($p);
$str = $this->replaceInTpl($str, $nav, $tit, $p->name);
$this->save($this->getPrefix().$p->name, $str);
}
/**
* Return the HTML code for the navigation bar
*
* @param int $i Index of the current element in the the array containing all
* the elements of the current package
*
* @return string A list of HTML LI
*/
private function getNavigationBlock($i)
{
$prev = $this->getPreviousElement($i);
$next = $this->getNextElement($i);
$type = $this->getTypeName();
$str = $this->getCommonLinks();
if (!empty($prev))
$str .= '<li><a href="'.$this->getPrefix().$prev->name.'.'.self::FILE_EXT.'" class="left">Prev '.$type.'</a></li>';
$str .= $this->getNavigParentPackage();
if (!empty($next))
$str .= '<li><a href="'.$this->getPrefix().$next->name.'.'.self::FILE_EXT.'" class="right">Next '.$type.'</a></li>';
return $str;
}
private function getTitleBlock($i)
{
$elem = $this->getCurrentElement($i);
$str = '<h1 class="'.$this->getStyleName();
if ($elem->isAbstract)
$str .= ' abstract';
return $str.'">'.$elem->name.'</h1>';
}
private function getDescriptionBlock(PHP_UML_Metamodel_Classifier $p)
{
$allInherited = $this->getAllInherited($p);
$nbAllInherited = count($allInherited);
$allImplemented = $this->getAllImplemented($p);
$nbAllImplemented = count($allImplemented);
$allInheriting = $this->getAllInheriting($p);
$nbAllInheriting = count($allInheriting);
$allImplementing = $this->getAllImplementing($p);
$nbAllImplementing = count($allImplementing);
$typeName = $this->getTypeName();
if ($p->isAbstract)
$typeName = 'abstract '.$typeName;
if ($p->isReadOnly)
$typeName = 'final '.$typeName;
$str = '<div class="description"><p>'.ucfirst($typeName).
' <span class="title">'.$this->getQualifiedName($p).'</span>';
$css = 'link2';
if (!empty($p->superClass[0])) {
$str .= ' extends ';
if (is_object($p->superClass[0]))
$str .= $this->getLinkTo($p->superClass[0], $css);
else
$str .= $this->displayUnresolved($p->superClass[0]);
}
if (isset($p->implements)) {
$nbImpl = count($p->implements);
if ($nbImpl>0) {
$str .= ' implements ';
for ($i=0; $i<$nbImpl; $i++) {
if (!empty($p->implements[$i])) {
if (is_object($p->implements[$i]))
$str .= $this->getLinkTo($p->implements[$i], $css);
else
$str .= $this->displayUnresolved($p->implements[$i]);
if ($i<$nbImpl-1)
$str .= ', ';
}
}
}
}
$str .= '</p>';
$str .= '<ul class="description">';
if (!is_null($p->description)) {
$str .= $this->getTagsAsList($p->description);
}
if ($nbAllImplemented>0) {
$str .= '<li>All implemented interfaces: ';
foreach ($allImplemented as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
if ($nbAllInheriting>0) {
$str .= '<li>All subclasses: ';
foreach ($allInheriting as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
if ($nbAllImplementing>0) {
$str .= '<li>All implementing classes: ';
foreach ($allImplementing as $ai) {
$str .= $this->getLinkTo($ai, $css).', ';
}
$str = substr($str, 0, -2);
$str .= '</li>';
}
$str .= $this->getFileInfo($p);
$str .= '</ul></div>';
if ($nbAllInherited>0) {
$str .= '<dl class="inheritTree">';
$sum = -15;
$img = '<img src="'.$this->getContextPackage()->rpt.self::RESOURCES_DIRNAME.'/inherit.gif" alt="extended by "/>';
foreach ($allInherited as $ai) {
$str .= '<dd style="padding-left:'.$sum.'px">';
$fullName = $this->getLinkTo($ai, $css);
if ($sum>0)
$str .= $img;
$sum += 15 + 2*(strlen(strstr($fullName, '>'))-5);
$str .= $fullName.'</dd>';
}
$str .= '<dd style="padding-left:'.$sum.'px" class="current">'.$img;
$str .= $this->getAbsPath($p->package, self::T_NAMESPACE).$p->name.'</dd>';
$str .= '</dl>';
}
return $str;
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the datatype renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocDatatype extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'datatype';
}
protected function getStyleName()
{
return 'datatype';
}
protected function getPrefix()
{
return self::DATATYPE_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->datatypes[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->datatypes) ? $this->getContextPackage()->datatypes[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->datatypes[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,354 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* General class for an renderer in the HtmlNew implementation
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
abstract class PHP_UML_Output_HtmlNew_DocElement extends PHP_UML_Output_ApiRenderer
{
const FILE_EXT = 'htm';
const RESOURCES_DIRNAME = '$resources';
const HELP_FILENAME = 'help';
const INDEX_FILENAME = 'index';
const INDEXALL_FILENAME = 'index-all';
const MENU_FILENAME = 'menu';
const JS_MAIN_NAME = 'MainList';
const TEMPLATES_DIRNAME = 'templates';
/**
* Constructor
*
* @param PHP_UML_Output_ExporterAPI $exporter Reference to an exporter
*/
public function __construct(PHP_UML_Output_ExporterAPI $exporter)
{
parent::__construct($exporter);
$this->mainTpl = $this->getTemplate('main.htm');
}
protected function getDescription(PHP_UML_Metamodel_Stereotype $s, $annotatedElement='')
{
$tag = PHP_UML_Metamodel_Helper::getStereotypeTag($s, 'description');
if (!is_null($tag))
return nl2br(htmlspecialchars($tag->value));
else
return '';
}
/**
* Renders the operation's parameters, as a comma-sep list, between brackets
*
* @param PHP_UML_Metamodel_Operation $operation The operation
* @param bool $withType If true, adds an hyperlink
*
* @return string
*/
protected function getParameterList(PHP_UML_Metamodel_Operation $operation, $withType = false)
{
$n = count($operation->ownedParameter);
$pieces = array();
for ($i=0; $i<$n; $i++) {
$parameter = $operation->ownedParameter[$i];
if (substr($parameter->direction, 0, 2)=='in') {
$str = '';
if ($withType && isset($parameter->type)) {
if (is_object($parameter->type))
$str .= $this->getLinkTo($parameter->type).' ';
else
$str .= $this->displayUnresolved($parameter->type);
}
if ($parameter->direction=='inout') {
$str .= '&#38;';
}
$str .= $parameter->name;
$str .= $this->getDefaultValue($parameter);
$pieces[] = $str;
}
}
return '('.implode(',', $pieces).')';
}
protected function getDefaultValue(PHP_UML_Metamodel_TypedElement $obj)
{
if ($obj->default!='')
return '<span class="defVal"> = '.htmlentities($obj->default, ENT_QUOTES).'</span>';
else
return '';
}
/**
* Renders a HTML hyperlink towards a given element
* (since datatypes don't own to a "package", we suppose they are located in
* the top package)
*
* @param PHP_UML_Metamodel_Classifier $t The element
* @param string $cssStyle CSS style to use
*
* @return string
*/
protected function getLinkTo(PHP_UML_Metamodel_Classifier $t, $cssStyle='link')
{
$loc = '';
$ns = '';
if (isset($t->package)) {
$loc = $this->getAbsPath($t->package);
$ns = $this->getAbsPath($t->package, self::T_NAMESPACE);
}
return '<a href="'.$this->getContextPackage()->rpt.$loc.self::getObjPrefix($t).$t->name.'.'.
self::FILE_EXT.'" class="'.$cssStyle.'">'.$ns.$t->name.'</a>';
}
/**
* Renders an unresolved type as an HTML span
*
* @param string $type Type, provided as a string
*
* @return string
*/
protected function displayUnresolved($type)
{
return '<span class="link">'.$type.'</span> ';
}
/**
* Renders the properties of a given stereotype as an HTML list (LI tags).
* Docblocks in $ignoredTag are not shown, as well as "return" tag with only a type
*
* @param PHP_UML_Metamodel_Stereotype $s A stereotype
*
* @return string
*/
protected function getTagsAsList(PHP_UML_Metamodel_Stereotype $s)
{
$str = '';
foreach ($s->ownedAttribute as $tag) {
if (!(in_array($tag->name, $this->ignoredTag) || ($tag->name=='return' && strpos($tag->value, ' ')===false))) {
if ($tag->name!='description') {
$str .= '<li class="smaller">';
$str .= '@'.$tag->name.' ';
} else {
$str .= '<li>';
}
if (strlen($tag->value)>0)
$str .= nl2br(htmlspecialchars($tag->value));
$str .= '</li>';
}
}
return $str;
}
/**
* Renders the block "Properties" of a package or a class as HTML
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier/a package
*
* @return string
*/
protected function getPropertyBlock(PHP_UML_Metamodel_NamedElement $p)
{
if (empty($p->ownedAttribute))
return '';
$str = '<h2>Properties</h2>';
$str .= '<ul class="summary">';
foreach ($p->ownedAttribute as $o) {
$str .= '<li class="Collapsed" id="'.$this->generatePropertyId($o).'">';
$str .= '<a href="javascript:void(0);" class="'.
$this->getPropertyStyle($o->visibility).'" target="main">'.
$o->name.'</a>';
$str .= '<ul class="description"><li>';
$str .= ucfirst($o->visibility).' ';
if (!$o->isInstantiable)
$str .= 'static ';
if ($o->isReadOnly)
$str .= 'const ';
if (is_object($o->type))
$str .= $this->getLinkTo($o->type).' ';
else
$str .= $this->displayUnresolved($o->type);
$str .= '<span class="smallTitle">'.$o->name.'</span>'.$this->getDefaultValue($o).'</li>';
if (!is_null($o->description)) {
$str .= $this->getTagsAsList($o->description);
}
$str .= $this->getFileInfo($o);
$str .= '</ul>';
$str .= '</li>';
}
$str .= '</ul>';
return $str;
}
/**
* Renders the block "Function" of a package or a classifier as HTML
*
* @param PHP_UML_Metamodel_NamedElement $p A classifier or a package
*
* @return string
*/
protected function getFunctionBlock(PHP_UML_Metamodel_NamedElement $p)
{
if (empty($p->ownedOperation))
return'';
$str = '<h2>Functions</h2>';
$str .= '<ul class="summary">';
foreach ($p->ownedOperation as $o) {
$fullName = $this->getParameterList($o, true);
$str .= '<li class="Collapsed" id="'.$this->generateFunctionId($o).'">';
$str .= '<a href="javascript:void(0);" class="'.$this->getFunctionStyle($o->visibility);
if ($o->isAbstract)
$str .= ' abstract';
$str .= '" target="main">'.$o->name.'</a>'.$fullName;
$str .= '<ul class="description"><li>';
$str .= ucfirst($o->visibility).' ';
if (!$o->isInstantiable)
$str .= 'static ';
if ($o->isAbstract)
$str .= 'abstract ';
$return = $this->getReturnParam($o);
if (!empty($return)) {
if (is_object($return->type))
$str .= $this->getLinkTo($return->type).' ';
else
$str .= $this->displayUnresolved($return->type);
}
$str .= '<span class="smallTitle">'.$o->name.'</span>'.$fullName.'</li>';
if (!is_null($o->description)) {
$str .= $this->getTagsAsList($o->description);
}
foreach ($this->getAllImplemented($p) as $ai) {
foreach ($ai->ownedOperation as $aiO) {
if ($aiO->name == $o->name && !empty($aiO->description)) {
$txt = $this->getDescription($aiO->description, $aiO->id);
if ($txt!='')
$str .= '<li>'.$txt.'<br/><span class="note">(copied from interface '.$this->getLinkTo($ai).')</span></li>';
}
}
}
foreach ($this->getAllInherited($p) as $ai) {
foreach ($ai->ownedOperation as $aiO) {
if ($aiO->name == $o->name && !empty($aiO->description)) {
$txt = $this->getDescription($aiO->description, $aiO->id);
if ($txt!='')
$str .= '<li>'.$txt.'<br/><span class="note">(copied from class '.$this->getLinkTo($ai).')</span></li>';
}
}
}
$str .= $this->getFileInfo($o);
$str .= '</ul>';
$str .= '</li>';
}
$str .= '</ul>';
return $str;
}
/**
* Returns the HTML for the link "Package" in the navigation bar
*
* @param string $rel A prefix to add to the hyperlink (eg: ../)
*
* @return string
*/
protected function getNavigParentPackage($rel='')
{
return '<li><a href="'.$rel.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="top">Package</a></li>';
}
/**
* Returns the HTML code for the common items of the navigation bar
*
* @return string
*/
protected function getCommonLinks()
{
return '<li><a href="javascript:toggler.toggleAll(\''.self::JS_MAIN_NAME.'\', \'btnToggle\')" class="expandAllBtn" id="btnToggle">Expand all</a></li>'.
'<li><a href="'.$this->getContextPackage()->rpt.self::HELP_FILENAME.'.'.self::FILE_EXT.'" class="helpBtn">Help</a></li>'.
'<li><a href="'.$this->getContextPackage()->rpt.self::INDEXALL_FILENAME.'.'.self::FILE_EXT.'" class="indexAllBtn">Index</a></li>';
}
/**
* Returns the HTML code for the "File" information tag
*
* @param PHP_UML_Metamodel_NamedElement $p An element
*
* @return string
*/
protected function getFileInfo(PHP_UML_Metamodel_NamedElement $p)
{
if (!empty($p->file->package))
return '<li>File: '.$this->getAbsPath($p->file->package).$p->file->name.'</li>';
else
return '';
}
protected function getPropertyStyle($visibility)
{
return 'property-'.substr($visibility, 0, 3);
}
protected function getFunctionStyle($visibility)
{
return 'method-'.substr($visibility, 0, 3);
}
/**
* Replace the template's placeholders with their value
*
* @param string $main Main HTML content (generated by PHP_UML)
* @param string $nav Navigation HTML content (navig bar)
* @param string $tit Title content
* @param string $name Element name
*
* @return string
*/
protected function replaceInTpl($main, $nav, $tit, $name)
{
$str = str_replace('#NAVIG', $nav, $this->mainTpl);
$str = str_replace('#TITLE', $tit, $str);
$str = str_replace('#DETAIL', $main, $str);
$str = str_replace('#RELPATHTOP', $this->getContextPackage()->rpt, $str);
$str = str_replace('#NAME', $this->getTypeName().' '.$name, $str);
$str = str_replace('#CURDATE', date("M j, Y, G:i:s O"), $str);
return $str;
}
protected function getTemplateDirectory()
{
return dirname(__FILE__).DIRECTORY_SEPARATOR.self::TEMPLATES_DIRNAME;
}
protected function save($elementName, $str)
{
$fic = $this->getContextPackage()->dir.$elementName.'.'.self::FILE_EXT;
file_put_contents($fic, $str);
}
}
?>

View File

@@ -0,0 +1,159 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for the Index page
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocIndex extends PHP_UML_Output_HtmlNew_DocMenu
{
/**
* Temporary structure to store all the elements (in order to sort them)
* @var array First index: the element, Second index: filepath to detail page, Third index: true only for operations/attributes of a Package (procedural code)
*/
private $elements = array();
/**
* Generates and saves the HTML code for the Index page
*
* @param PHP_UML_Metamodel_Package $p Package to render
*/
public function render($p)
{
$tpl = $this->getTemplate(self::INDEXALL_FILENAME.'.'.self::FILE_EXT);
$nav = $this->getNavigationBlock();
$str = '<ul id="MainList" class="indexAll">';
$str .= $this->getContent($p);
$str .= '</ul>';
$tmp = str_replace('#NAVIG', $nav, $tpl);
$str = str_replace('#INDEX', $str, $tmp);
$this->save(self::INDEXALL_FILENAME, $str);
}
/**
* Return the HTML code for an Index page
*
* @param PHP_UML_Metamodel_Package $p Starting package
*
* @return string HTML code
*/
private function getContent(PHP_UML_Metamodel_Package $p)
{
$this->readPackage($p);
$str = '';
usort($this->elements, array('self', 'compareElt'));
foreach ($this->elements as $x) {
list($elt, $path, $pkgElt) = $x;
switch(get_class($elt)) {
case self::META_CLASS:
case self::META_INTERFACE:
$str .= $this->getClassifierItem($elt, $path, 0);
break;
case self::META_OPERATION:
if ($pkgElt)
$str .= $this->getPackageOperationItem($elt, $path);
else
$str .= $this->getOperationItem($elt, $path);
break;
case self::META_PROPERTY:
if ($pkgElt)
$str .= $this->getPackagePropertyItem($elt, $path);
else
$str .= $this->getPropertyItem($elt, $path);
break;
}
}
return $str;
}
static private function compareElt($a, $b)
{
return strcasecmp($a[0]->name, $b[0]->name);
}
/**
* Set the elements[] property with the API data of a package
*
* @param PHP_UML_Metamodel_Package $p Package
* @param string $path Relative path to the current package
* @param string $level Recursion level
*
* @return void
*/
private function readPackage(PHP_UML_Metamodel_Package $p, $path='', $level=0)
{
foreach ($p->nestedPackage as $np) {
$npDir = $path.$np->name;
$this->readPackage($np, $npDir.'/', $level+1);
}
foreach ($p->ownedType as $c) {
$this->elements[] = array($c, $path, false);
foreach ($c->ownedOperation as $o) {
$this->elements[] = array($o, $path, false);
}
if (isset($c->ownedAttribute)) {
foreach ($c->ownedAttribute as $a) {
$this->elements[] = array($a, $path, false);
}
}
}
foreach ($p->ownedOperation as $o) {
$this->elements[] = array($o, $path, true);
}
foreach ($p->ownedAttribute as $a) {
$this->elements[] = array($a, $path, true);
}
}
/**
* Return the HTML code for the navigation bar
*
* @return string
*/
private function getNavigationBlock()
{
$str = '<ul class="navig">';
$str .= $this->getCommonLinks();
$str .= '</ul>';
return $str;
}
protected function getPropertyItem(PHP_UML_Metamodel_Property $p, $path)
{
return '<li>'.
'<a href="'.$path.self::getObjPrefix($p->class).$p->class->name.'.'.self::FILE_EXT.'#'.$p->name.
'" class="'.$this->getPropertyStyle($p->visibility).'" target="main">'.$p->name.'</a>'.
'</li>';
}
protected function getOperationItem(PHP_UML_Metamodel_Operation $o, $path)
{
return '<li>'.
'<a href="'.$path.self::getObjPrefix($o->class).$o->class->name.'.'.self::FILE_EXT.'#f'.$o->id.
'" class="'.$this->getFunctionStyle($o->visibility).'" target="main">'.$o->name.$this->getParameterList($o).'</a>'.
'</li>';
}
}
?>

View File

@@ -0,0 +1,59 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the class renderer
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocInterface extends PHP_UML_Output_HtmlNew_DocClassifier
{
protected function getTypeName()
{
return 'interface';
}
protected function getStyleName()
{
return 'interface';
}
protected function getPrefix()
{
return self::INTERFACE_PREFIX;
}
protected function getCurrentElement($i)
{
return $this->getContextPackage()->interfaces[$i];
}
protected function getNextElement($i)
{
return $i+1<count($this->getContextPackage()->interfaces) ? $this->getContextPackage()->interfaces[$i+1] : null;
}
protected function getPreviousElement($i)
{
return $i>0 ? $this->getContextPackage()->interfaces[$i-1] : null;
}
}
?>

View File

@@ -0,0 +1,126 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for the treeview menu (on the left panel)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocMenu extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Generates and saves the HTML menu
*
* @param PHP_UML_Metamodel_Package $p Starting package
*/
public function render($p)
{
$tpl = $this->getTemplate(self::MENU_FILENAME.'.'.self::FILE_EXT);
$str = '<ul class="TreeView" id="MainList">';
$str .= $this->getContent($p);
$str .= '</ul>';
$str = str_replace('#MENU', $str, $tpl);
$this->save(self::MENU_FILENAME, $str);
}
/**
* Returns the HTML content for a whole model
*
* @param PHP_UML_Metamodel_Package $p Starting package
*
* @return string
*/
private function getContent(PHP_UML_Metamodel_Package $p)
{
return $this->getPackage($p);
}
/**
* Returns the HTML content for a given package
*
* @param PHP_UML_Metamodel_Package $p Package
* @param string $path Relative path to the current package
* @param int $level Recursion level
*
* @return string
*/
private function getPackage(PHP_UML_Metamodel_Package $p, $path='', $level=0)
{
$pt = $level>0 ? 'package' : 'model';
$empty = (count($p->nestedPackage)==0 && count($p->ownedType)==0 && count($p->ownedOperation)==0 && count($p->ownedAttribute)==0);
$str = ($level==0 ? '<li class="Expanded">' : ($empty ? '<li>' : '<li class="Collapsed">'));
$str .= '<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="'.$pt.'" target="main">'.$p->name.'</a>';
if (!$empty) {
$str .= '<ul>';
foreach ($p->nestedPackage as $np) {
$npDir = $path.$np->name;
$str .= $this->getPackage($np, $npDir.'/', $level+1);
}
foreach ($p->ownedType as $c) {
$str .= $this->getClassifierItem($c, $path, $level);
}
foreach ($p->ownedAttribute as $a) {
$str .= $this->getPackagePropertyItem($a, $path);
}
foreach ($p->ownedOperation as $o) {
$str .= $this->getPackageOperationItem($o, $path);
}
$str .= '</ul>';
}
$str .= '</li>';
return $str;
}
protected function getPackagePropertyItem(PHP_UML_Metamodel_Property $p, $path)
{
return '<li>'.
'<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'#'.$this->generatePropertyId($p).
'" class="property" target="main">'.$p->name.'</a>'.
'</li>';
}
protected function getPackageOperationItem(PHP_UML_Metamodel_Operation $o, $path)
{
return '<li>'.
'<a href="'.$path.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'#'.$this->generateFunctionId($o).
'" class="method" target="main">'.$o->name.$this->getParameterList($o).'</a>'.
'</li>';
}
protected function getClassifierItem(PHP_UML_Metamodel_Classifier $c, $path, $level)
{
$str = '';
if ($level>0 || !in_array($c->name, $this->hiddenClassifiers)) {
$str .= '<li>'.
'<a href="'.$path.self::getObjPrefix($c).$c->name.'.'.self::FILE_EXT.
'" class="'.self::getObjStyle($c);
if ($c->isAbstract)
$str .= ' abstract';
$str .= '" target="main">'.$c->name.'</a></li>';
}
return $str;
}
}
?>

View File

@@ -0,0 +1,144 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Implementation of the HTML renderer for a Package
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocPackage extends PHP_UML_Output_HtmlNew_DocElement
{
/**
* Generates and saves the HTML code for a package
*
* @param PHP_UML_Metamodel_Package $p Starting package
*/
public function render($p)
{
if ($this->getContextPackage()->dir=='') {
$fullName = $p->name;
} else {
$fullName = rtrim($this->getAbsPath($p, self::T_NAMESPACE), self::T_NAMESPACE);
}
$nav = $this->getNavigationBlock();
$tit = $this->getTitleBlock($fullName);
$str = $this->getDescriptionBlock($p);
$str .= $this->getPropertyBlock($p);
$str .= $this->getFunctionBlock($p);
$str = $this->replaceInTpl($str, $nav, $tit, $fullName);
$this->save(self::PACKAGE_FILENAME, $str);
}
private function getDescriptionBlock($p)
{
$str = '';
if (!is_null($p->description)) {
$str .= '<div class="descriptionPkg"><p><ul class="single">'.$this->getTagsAsList($p->description).'</ul></p></div>';
}
if (count($p->nestedPackage)>0) {
$str .= '<h2>Packages</h2>';
$str .= '<ul class="summary">';
foreach ($p->nestedPackage as $np) {
$str .= '<li>';
$str .= '<a href="'.$np->name.'/'.self::PACKAGE_FILENAME.'.'.self::FILE_EXT.'" class="package" target="main">'.$np->name.'</a>';
$str .= '</li>';
}
$str .= '</ul>';
}
$display = false;
$tmp = '<h2>Classes</h2>';
$tmp .= '<ul class="summary">';
foreach ($this->getContextPackage()->classes as $o) {
if ($this->getContextPackage()->dir!='' || !in_array($o->name, $this->hiddenClasses)) {
$display = true;
$tmp .= '<li>'.
'<a href="'.self::getObjPrefix($o).$o->name.'.'.self::FILE_EXT.'" class="'.self::getObjStyle($o).'" target="main">'.$o->name.'</a>'.
'</li>';
}
}
$tmp .= '</ul>';
if ($display)
$str .= $tmp;
$display = false;
$tmp = '<h2>Interfaces</h2>';
$tmp .= '<ul class="summary">';
foreach ($this->getContextPackage()->interfaces as $o) {
if ($this->getContextPackage()->dir!='' || !in_array($o->name, $this->hiddenInterfaces)) {
$display = true;
$tmp .= '<li>'.
'<a href="'.self::getObjPrefix($o).$o->name.'.'.self::FILE_EXT.'" class="'.self::getObjStyle($o).'" target="main">'.$o->name.'</a>'.
'</li>';
}
}
$tmp .= '</ul>';
if ($display)
$str .= $tmp;
return $str;
}
/**
* Return the HTML code for the navigation bar
*
* @return string
*/
private function getNavigationBlock()
{
$str = $this->getCommonLinks();
if (!empty($this->getContextPackage()->rpt))
$str .= $this->getNavigParentPackage('../');
return $str;
}
private function getTitleBlock($name)
{
return '<h1 class="'.$this->getStyleName().'">'.$name.'</h1>';
}
private function getStyleName()
{
return $this->getContextPackage()->dir=='' ? 'model' : 'package';
}
protected function getTypeName()
{
return $this->getStyleName();
}
protected function getPropertyStyle($visibility)
{
return 'property';
}
protected function getFunctionStyle($visibility)
{
return 'method';
}
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 169 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-12 01:28:43 +0200 (lun., 12 sept. 2011) $
*/
/**
* Rendering of the resources
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_DocResources extends PHP_UML_Output_HtmlNew_DocElement
{
public function render($p)
{
$dir = $this->getContextPackage()->dir;
$baseSrc = dirname(__FILE__).DIRECTORY_SEPARATOR;
$index = $this->getTemplate(self::INDEX_FILENAME.'.'.self::FILE_EXT);
$modelName = $p->name;
$index = str_replace('#MODELNAME', $modelName, $index);
file_put_contents($dir.self::INDEX_FILENAME.'.'.self::FILE_EXT, $index);
$src = dirname(__FILE__).DIRECTORY_SEPARATOR.self::TEMPLATES_DIRNAME.DIRECTORY_SEPARATOR.self::HELP_FILENAME.'.'.self::FILE_EXT;
copy($src, $dir.self::HELP_FILENAME.'.'.self::FILE_EXT);
$src = $baseSrc.self::RESOURCES_DIRNAME;
$dest = $dir.self::RESOURCES_DIRNAME;
if (!file_exists($dest)) {
mkdir($dest);
}
if (file_exists($src)) {
$iterator = new DirectoryIterator($src);
foreach ($iterator as $file) {
if ($file->isFile())
copy($file->getPathname(), $dest.DIRECTORY_SEPARATOR.$file->getFilename());
}
}
}
}
?>

View File

@@ -0,0 +1,102 @@
<?php
/**
* PHP_UML
*
* PHP version 5
*
* @category PHP
* @package PHP_UML
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
* @version SVN: $Revision: 176 $
* @link http://pear.php.net/package/PHP_UML
* @since $Date: 2011-09-19 00:03:11 +0200 (lun., 19 sept. 2011) $
*/
/**
* This class generates an HTML website from a UML model (a PHP_UML_Metamodel)
*
* @category PHP
* @package PHP_UML
* @subpackage Output
* @subpackage HtmlNew
* @author Baptiste Autin <ohlesbeauxjours@yahoo.fr>
* @license http://www.gnu.org/licenses/lgpl.html LGPL License 3
*/
class PHP_UML_Output_HtmlNew_Exporter extends PHP_UML_Output_ExporterAPI
{
private $docClass;
private $docInterface;
private $docDatatype;
private $docPackage;
private $docMenu;
private $docIndex;
private $docResources;
public function export($outDir)
{
$userCurrentDir = getcwd();
if (substr($outDir, -1) != DIRECTORY_SEPARATOR)
$outDir .= DIRECTORY_SEPARATOR;
parent::export($outDir);
$this->ctx = new PHP_UML_Output_ApiContextPackage();
$this->docClass = new PHP_UML_Output_HtmlNew_DocClass($this);
$this->docInterface = new PHP_UML_Output_HtmlNew_DocInterface($this);
$this->docDatatype = new PHP_UML_Output_HtmlNew_DocDatatype($this);
$this->docPackage = new PHP_UML_Output_HtmlNew_DocPackage($this);
$this->docMenu = new PHP_UML_Output_HtmlNew_DocMenu($this);
$this->docIndex = new PHP_UML_Output_HtmlNew_DocIndex($this);
$this->docResources = new PHP_UML_Output_HtmlNew_DocResources($this);
chdir($outDir);
$this->docResources->render($this->structure->packages);
$this->docMenu->render($this->structure->packages);
$this->docIndex->render($this->structure->packages);
// we analyse the inheritance/impl relations beforehand:
$this->setAllSuperClassifiers($this->structure->packages);
$this->treatPackage($this->structure->packages);
chdir($userCurrentDir);
}
/**
* Recurses into the packages, and generates the detailed file (one file
* per class/interface/package)
*
* @param PHP_UML_Metamodel_Package $pkg Starting package
* @param string $dir Filepath leading to the current package
* @param string $rpt Relative filepath to the top package
*/
private function treatPackage(PHP_UML_Metamodel_Package $pkg, $dir='', $rpt='')
{
$this->initContextPackage($pkg, $dir, $rpt);
$this->docPackage->render($pkg, $this->ctx);
$nbc = count($this->ctx->classes);
$nbi = count($this->ctx->interfaces);
$nbd = count($this->ctx->datatypes);
for ($i=0; $i<$nbc; $i++)
$this->docClass->render($i);
for ($i=0; $i<$nbi; $i++)
$this->docInterface->render($i);
for ($i=0; $i<$nbd; $i++)
$this->docDatatype->render($i);
foreach ($pkg->nestedPackage as $np) {
$npDir = $dir.$np->name;
if (!file_exists($npDir))
mkdir($npDir);
$this->treatPackage($np, $npDir.DIRECTORY_SEPARATOR, '../'.$rpt);
}
}
}
?>

View File

@@ -0,0 +1,67 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>API Help</title>
<link type="text/css" rel="stylesheet" href="$resources/style.css"/>
<script type="text/javascript" language="javascript" src="$resources/treeview.js"></script>
</head>
<body>
<h1 class="help">How this API document is organized</h1>
<div class="description">
<h2>Menu</h2>
<p>The menu in the left panel provides a treeview of all packages, classes and interfaces.
It also contains the procedural functions and global constants (defined with the <i>define</i> keyword).
Click on a item to display its detailed page in the right panel.</p>
<h2>Package</h2>
<p>Each package has a page that contains a list of its classes, interfaces, with a summary for each.</p>
<p>Even if packages don't exist by themselves in PHP, PHP_UML reconstitutes them using the PHP namespaces (from PHP 5.3),
or by using the docblock @package (if the source code has some).<br/>
The top package is showed like a UML Model, and matches the "global namespace" of PHP.</p>
<p>From version 1.5, PHP_UML can display non strictly object-oriented elements, like procedural functions and global
constants. The former appear under "Functions" and the latter under "Properties", inside the Package page that matches the
namespace that these elements belong to.</p>
<h2>Class/Interface</h2>
<p>Each class and interface has its own separate page. Each of these pages starts with a description block.</p>
<p>The description block displays the content of the comment just preceding the class/interface definition in the source code,
followed by a list of the docblocks, as well the source file name.<br/>
It also lists : all inherited classes, all subclasses, all known subinterfaces, and all known implementing classes.</p>
<p>Then the following elements appear:</p>
<ul>
<li>Class inheritance diagram</li>
<li>Function Summary (all the methods of the class/interface)</li>
<li>Property Summary (all the constants and properties of the class)</li>
</ul>
<p>Click on a function/property title to expand it down, and see more detailed information about it (comment, docblocks).</p>
<p>All elements are in the order they appear in the source code.</p>
<h2>Index</h2>
<p>The Index contains an alphabetic list of all classes, interfaces, functions, properties and constants.</p>
<h2>Prev/Next</h2>
<p>These links take you to the next or previous class, interface, package, or related page.</p>
<h2>Expand/Collapse all</h2>
<p>In a class/interface/package page, click on "Expand all" to expand the detailed information about all members (functions, properties...).
The state of the button "Expand all / Collapse all" is preserved between page requests (unless you have cookies disabled in your browser).</p>
<h2>PHP and types</h2>
<p>Even though PHP is not a strong typed language, PHP_UML relies on a set of predefined types (integer, float, string, mixed, etc.)
and tries to use them as much as it can guess. When it had not been able to resolve a type/class/interface
(for example, a class implements an interface whose source code had not been provided), the type is displayed, but is not clickable.</p>
<p>PHP_UML is also aware of a couple of internal PHP classifiers, such as Exception or Iterator.</p>
</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>#MODELNAME</title>
<link type="text/css" rel="stylesheet" href="$resources/style.css"/>
<script type="text/javascript" language="javascript" src="$resources/treeview.js"></script>
</head>
<body onload="toggler.setupTreeView('TreeView');">
#NAVIG
<h1 class="index">Index</h1>
#INDEX
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>#MODELNAME API documentation</title>
</head>
<frameset cols="20%,80%">
<frame name="menu" src="menu.htm" frameborder="0"/>
<frame name="main" src="package-summary.htm" frameborder="0"/>
</frameset>
</html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>#NAME</title>
<link type="text/css" rel="stylesheet" href="#RELPATHTOP$resources/style.css"/>
<script type="text/javascript" language="javascript" src="#RELPATHTOP$resources/treeview.js"></script>
</head>
<body onload="toggler.setupTreeView('MainList');toggler.backToMemorizedState('MainList', 'btnToggle')">
<ul class="navig">
#NAVIG
</ul>
#TITLE
<div id="MainList">
#DETAIL
</div>
<div id="footer">Documentation generated on #CURDATE by <a href="http://pear.php.net/package/PHP_UML/" target="_new">PHP_UML</a></div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>API Menu</title>
<link type="text/css" rel="stylesheet" href="$resources/style.css"/>
<script type="text/javascript" language="javascript" src="$resources/treeview.js"></script>
</head>
<body onload="toggler.setupTreeView('MainList');">
#MENU
</body>
</html>