-
Notifications
You must be signed in to change notification settings - Fork 28
/
faq.php
96 lines (83 loc) · 2.18 KB
/
faq.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
require_once("bootstrap.inc.php");
class PouetBoxFAQ extends PouetBox
{
public $entries;
function __construct()
{
parent::__construct();
$this->uniqueID = "pouetbox_faq";
$this->title = "the always incomplete pouët.net faq";
}
function LoadFromDB()
{
$this->entries = SQLLib::SelectRows("select * from faq where deprecated = 0 order by category, id");
}
function RenderBody()
{
echo "<div class='content' id='faq_toc'>\n";
$lastType = "";
foreach($this->entries as $e)
{
if ($lastType != $e->category)
{
if ($lastType)
echo "</ul>\n";
echo "<h3>"._html($e->category)."</h3>\n";
$lastType = $e->category;
echo "<ul>\n";
}
echo "<li><a href='#faq"._html($e->id)."'>".$e->question."</a></li>\n";
}
echo "</ul>\n";
echo "</div>\n";
$lastType = "";
foreach($this->entries as $e)
{
if ($lastType != $e->category)
{
if ($lastType)
echo "</dl>\n";
echo "<h2>:: "._html($e->category)."</h2>\n";
$lastType = $e->category;
echo "<dl class='faq'>\n";
}
echo "<dt id='faq"._html($e->id)."'>:: "._html($e->category)." :: ".$e->question."</dt>\n";
echo "<dd>".$e->answer."</dd>\n";
}
echo "</dl>\n";
}
};
$TITLE = "faq";
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
$box = new PouetBoxFAQ();
$box->Load();
$box->Render();
echo "</div>\n";
?>
<script>
<!--
document.observe("dom:loaded",function(){
$("faq_toc").hide();
$$(".faq > dd").invoke("hide");
$$(".faq > dt").each(function(item){
item.update( "[<a href='#" + item.id + "'>#</a>] " + item.innerHTML );
item.setStyle({"cursor":"pointer"});
item.observe("click",function(ev){
ev.findElement("dt").nextSiblings().first().toggle();
if (!ev.findElement("a"))
ev.stop();
});
});
var e = $$("dt#" + location.hash);
if (e.length) e.first().nextSiblings().first().show();
var v = location.hash; location.hash = v; // force firefox
});
//-->
</script>
<?php
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>