Commit 28f361a6 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 8dbfcf46
<table width=100% cellspacing=0 cellpadding=0>
<tr>
<td class='bordered' valign='top'>
<?php
if ( ! isset($_GET['chapter'])) {
foreach ($i as $k => $v) {
$indexes = explode('.', $v['index']);
$level = count($indexes);
$e = explode(' - ', $v['name']);
print '<div class=level' . $level . '><font class=level' . $level . '>&nbsp;'. $v['index'] . '. <a href=documentation2.php?chapter='
. urlencode($v['name']) . ">" . end($e) ."</a></font></div>";
}
} else {
$e = explode(' - ', $_GET['chapter']);
$subchapters = false;
$found = false;
foreach ($i as $k => $v) {
if ($found) {
if (strncmp($v['name'], $_GET['chapter'], strlen($_GET['chapter'])) === 0) {
$subchapters = true;
}
break;
}
$parts = explode(' - ', $v['name']);
$indexes = explode('.', $v['index']);
if ($v['name'] === $_GET['chapter']) {
if (isset($i[($k - 1)])) {
$prev = $i[($k - 1)];
}
if (isset($i[($k + 1)])) {
$next = $i[($k + 1)];
}
$foundKey = ($k + 1);
$found = $v;
}
}
?>
<table width=100% cellspacing=5 cellpadding=1>
<tr>
<td align='center' colspan=2>
<b class='title'>
<?php
$chapter = array_shift($parts);
print 'Chapter ' . $indexes[0] . '. ' . $chapter;
?>
</b>
</td>
</tr>
<tr>
<td align='left'>
<?php
if(isset($prev)) {
?>
<b><a href=documentation2.php?chapter=<?php print urlencode($prev['name']); ?>>Prev</a></b>
<?php
}
?>
</td>
<td align='right'>
<?php
if(isset($next)) {
?>
<b><a href=documentation2.php?chapter=<?php print urlencode($next['name']); ?>>Next</a></b></td>
<?php
}
?>
</tr>
<tr>
<td colspan=2>
<b class='title'>
<?php
//print implode('.', $indexes) . '. ' . implode(' - ', $parts);
?>
</b>
<hr>
<b class='title'>
<?php
print implode('.', $indexes) . '. ';
$stack = array();
$links = array();
$tmp = array_merge(array($chapter), $parts);
foreach($tmp as $k => $v) {
$stack[] = $v;
$links[] = "<a href=documentation2.php?chapter=" . urlencode(implode(' - ', $stack)) . '>' . $v . '</a>';
}
print implode(' - ', $links);
?>
<br \>
</b>
<hr class='small'>
<?php
if ($subchapters) {
?>
<b class='title'>
<div class='level1'> Table of contents</div>
</b>
<?php
for ($x = $foundKey; $x < count($i); $x++) {
$p = explode(' - ', $i[$x]['name']);
$count = (count($parts) + 1);
$l = count($p) - count($parts);
while($count--) {
array_shift($p);
}
print "<div class=level" . $l . '><font class=level' . $l . '>';
?>
<a href=documentation2.php?chapter=<?php print urlencode($i[$x]['name']) . '>' . end($p); ?></a>
</font></div>
<?php
if (strncmp($i[$x]['name'], $_GET['chapter'], strlen($_GET['chapter'])) !== 0) {
break;
}
}
}
$doc->renderBlock($found['name']);
}
?>
</td>
</tr>
</table>
</td>
<td width=10>
</td>
<td valign='top' width=300>
<div class='smallmenu'>
<font class=smallmenu>&nbsp; -- <a href=documentation2.php>index</a></font><br \>
<?php
foreach ($i as $k => $v) {
$indexes = explode('.', $v['index']);
$level = count($indexes);
$e = explode(' - ', $v['name']);
if($level === 1) {
$level++;
print '<font class=smallmenu>&nbsp;'. $v['index'] . '. <a href=documentation2.php?chapter='
. urlencode($v['name']) . ">" . end($e) ."</a></font><br \>";
}
}
?>
</div>
</td>
</tr>
</table>
......@@ -65,41 +65,7 @@ class DocTool
}
return $ret;
}
/**
if ($indent == $i) {
$path[$i] = $v;
} else {
*/
public function parseIndex($index, $path = array(), $counters = array())
{
$ret = array();
foreach ($index as $k => $v) {
$i = count($path) - 1;
$counters[$i]++;
if (is_array($v)) {
if ( ! is_numeric($k)) {
$tmp = $path;
$tmp[] = $k;
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $k : $k;
$ret[] = array('index' => implode('.', $counters),
'name' => $chapterName);
}
$ret = array_merge($ret, $this->parseIndex($v, $tmp, $counters));
} else {
$chapterName = ( ! empty($path)) ? implode(' - ', $path) . ' - ' . $v : $v;
$ret[] = array('index' => implode('.', $counters),
'name' => $chapterName);
}
}
return $ret;
}
public function renderBlock($name) {
if(file_exists("docs/$name.php")) {
......@@ -122,7 +88,7 @@ class DocTool
$this->highlighter->loadString($code);
print "<table width=500 border=1 class='dashed' cellpadding=0 cellspacing=0>";
print "<table border=1 class='dashed' cellpadding=0 cellspacing=0>";
print "<tr><td><b>";
$this->highlighter->toHtml();
......@@ -152,112 +118,16 @@ $i = $doc->parseIndex2($a);
<td align="left" valign="top">
<table width="100%" cellspacing=0 cellpadding=0>
<tr>
<td colspan=2 bgcolor="white">
<td colspan=3 bgcolor="white">
<img src="images/logo.jpg" align="left"><b class="title">Doctrine - PHP Data Persistence and ORM Tool</b>
<hr>
</td>
</tr>
<tr>
<td bgcolor="white" valign="top">
<div class='index'>
<?php
if ( ! isset($_GET['chapter'])) {
foreach ($i as $k => $v) {
$indexes = explode('.', $v['index']);
$level = count($indexes);
$e = explode(' - ', $v['name']);
print '<div class=level' . $level . '><font class=level' . $level . '>&nbsp;'. $v['index'] . '. <a href=documentation2.php?chapter='
. urlencode($v['name']) . ">" . end($e) ."</a></font></div>";
}
} else {
$e = explode(' - ', $_GET['chapter']);
$subchapters = false;
$found = false;
foreach ($i as $k => $v) {
if ($found) {
if (strncmp($v['name'], $_GET['chapter'], strlen($_GET['chapter'])) === 0) {
$subchapters = true;
}
break;
}
$parts = explode(' - ', $v['name']);
$indexes = explode('.', $v['index']);
if ($v['name'] === $_GET['chapter']) {
$prev = $i[($k - 1)];
$next = $i[($k + 1)];
$foundKey = ($k + 1);
$found = $v;
}
}
?>
<table width='100%'>
<tr><td colspan=3 align='center'><b></td></tr>
<tr><td colspan=3 align='center'><b class='title'>
<?php
print 'Chapter ' . $indexes[0] . '. ' . array_shift($parts);
?>
</b></td></tr>
<tr><td align='left'><b><a href=documentation2.php?chapter=<?php print urlencode($prev['name']); ?>>Prev</a></b></td>
<td align='right'><b><a href=documentation2.php?chapter=<?php print urlencode($next['name']); ?>>Next</a></b></td></tr>
<tr><td>&nbsp;</td></tr>
</table>
<b class='title'>
<?php
print $indexes[0] . '.' . $indexes[1] . '. ' . $parts[0];
?>
</b>
<hr>
<?php
if ($subchapters) {
?>
<b class='title'>
Table of contents<br \>
</b>
<?php
for ($x = $foundKey; $x < count($i); $x++) {
$p = explode(' - ', $i[$x]['name']);
$count = (count($parts) + 1);
while($count--) {
array_shift($p);
}
?>
<a href=documentation2.php?chapter=<?php print urlencode($i[$x]['name']) . '>' . implode(' - ', $p); ?></a><br \>
<?php
if (strncmp($i[$x]['name'], $_GET['chapter'], strlen($_GET['chapter'])) !== 0) {
break;
}
}
} else {
?>
<b class='title'>
<?php
if (isset($parts[1])) {
print $indexes[0] . '.' . $indexes[1] . '.' . $indexes[2] . '. ' . $parts[1];
}
?>
</b>
<hr class='small'>
<?php
}
$doc->renderBlock($found['name']);
}
include('content.php');
?>
</div>
</td>
</tr>
</td>
......
......@@ -299,7 +299,7 @@ class PHP_Highlight
} elseif ($blocks === true && in_array($i, $this->_plaintextkeys)) {
$out .= $line;
} else {
$out .= "<code>$line</code>";
$out .= "$line";
}
$out .= "</li>\n";
......@@ -339,7 +339,7 @@ class PHP_Highlight
// Format code
$source = $this->toArray($funcref);
$out = "<code>\n";
$out = "<div class='code'>\n";
foreach ($source as $i => $line) {
$out .= ' ';
......@@ -350,7 +350,7 @@ class PHP_Highlight
$out .= empty($line) ? '&nbsp;' : $line;
$out .= "<br />\n";
}
$out .= "</code>\n";
$out .= "</div>\n";
if ($return === true) {
return $out;
......
......@@ -69,12 +69,31 @@ background: #F5F5F5;
div.level5 {
}
div.index {
table.index {
border-style: solid;
border-color: #A0A0A0;
border-shadow: none;
border-width: thin;
}
td.bordered {
border-style: solid;
border-color: #A0A0A0;
border-shadow: none;
border-width: thin;
}
div.content {
margin: 5,5,5,5 px;
}
div.code {
font-family: monospace;
}
div.smallmenu {
border-style: solid;
border-color: #A0A0A0;
border-shadow: none;
border-width: thin;
background: #E9E9E9;
}
b.title {
color: #A50A3D;
}
......@@ -108,3 +127,7 @@ font.level4 {
font-size: 11 px;
margin-left: 90px;
}
font.smallmenu {
font-size: 13 px;
font-weight: bold;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment