[go: up one dir, main page]

Menu

[r21]: / faqQestionsTable.php  Maximize  Restore  History

Download this file

166 lines (136 with data), 4.7 kB

  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
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
include('includes/databaseLogin.php');
include('includes/installedLanguage.php');
echo "<!DOCTYPE html>";
?>
<html>
<head>
<link rel="stylesheet" href="css/style.css" />
</head>
<?php
$questionsCount = 0;
$indexCount = array(1 => 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
//find the distance from the root and build up a option for a select field
function labelOption($node, $nodeIndex, $tab){
$index=0;
$radice = '';
while($index<$tab){
$index++;
$radice = $radice . "--";
}
echo"<option value=\"" . $nodeIndex . "\">" . $radice . "" . $node . "</option>";
}
//Visit the labels tree and build up a
function moveTreeVisit($node, $index, $tab){
//cast the function to execute on the label
if($node != 'root'){
labelOption($node, $index, $tab);
}
//serch for label's sons
$getLabels = mysql_query("SELECT * FROM labels WHERE labelParent='" . $index . "'");
if(!$getLabels){
}else{
while($row = mysql_fetch_array($getLabels)) {
moveTreeVisit($row[labelName], $row[labelID], $row[labelTab]);
}
}
}
function nodeAndFaqDisplay($node, $index, $tab){
global $questionsCount;
echo "<table><tr><td><a href=\"#index\">[<img src=\"images/frecciasu.png\">]</a></td><td><a name=\"" . $node . "i" . $index . "\"><h" . $tab . " style=\"padding-bottom: 10px;\">" . $node . "</h" . $tab . "></a></td></tr></table>";
$questionsCount++;
$getQuestions = mysql_query("SELECT * FROM questions WHERE questStatus='2' AND questLabel='" . $index . "'");
if(!$getQuestions){
}else{
while($row = mysql_fetch_array($getQuestions)) {
echo "<div style=\"margin: 0px 0px 10px 0px; float: right; border: solid 1px gray; background-color: #FFCCFF; width: 100%;\">";
echo "<table style=\"width: 100%;\">";
echo "<tr><td><b><i>" . nl2br($row[questBody]) . "</i></b></td>";
if($_POST[priv] == 'w'){
echo "<td style=\"width: 10%; vertical-align: top; text-align: right;\"><a class=\"aFaqDelete\" name=\"" . $row[questID] . "\" href=\"#\"><img src=\"images/cancella.png\"></a></td></tr>";
echo "<tr><td><i>" . nl2br($row[questAnswer]) . "</i></td><td></td></tr>";
echo "<tr><td colspan=\"2\" style=\"text-align: right;\" valign=\"top\">" . _T("Move FAQ in") . "<select class=\"sNewChapter\" name=\"" . $row[questID] . "\" id=\"sel_" . $row[questID] . "\"><option value=\"0\"></option>";
moveTreeVisit('root', '1', '0');
echo "</select></td></tr>";
}else{
echo "<td></td></tr>";
echo "<tr><td><i>" . nl2br($row[questAnswer]) . "</i></td><td></td></tr>";
}
echo "</table>";
echo "</div>";
$questionsCount++;
}
}
}
function nodeAndIndexDisplay($node, $index, $tab){
global $indexCount;
$indexCount[$tab]++;
$wIndex = $tab + 1;
while($wIndex <= 20){
$indexCount[$wIndex] = 0;
$wIndex++;
}
$wIndex = 2;
$iIndex = $indexCount[1];
while($wIndex <= $tab){
$iIndex = $iIndex . "." . $indexCount[$wIndex];
$wIndex++;
}
$wIndex = 1;
echo "<p style=\"color: white;\">";
while($wIndex < $tab){
$wIndex++;
echo "....";
}
echo "<a href=\"#" . $node . "i" . $index . "\">[" . $iIndex . "] " . $node . "</a>";
echo "</p>";
}
function questionsDisplay($node, $index, $tab){
//$widthPerCent = 100 - 5 * ($tab - 1) - 1;
$widthPerCent = 100;
//cast the function to execute on the label
if($node != 'root'){
echo "<div style=\"float: right; width: " . $widthPerCent . "%;\">";
nodeAndFaqDisplay($node, $index, $tab);
}
//serch for label's sons
$getLabels = mysql_query("SELECT * FROM labels WHERE labelParent='" . $index . "'");
if(!$getLabels){
}else{
while($row = mysql_fetch_array($getLabels)) {
questionsDisplay($row[labelName], $row[labelID], $row[labelTab]);
}
}
if($node != 'root'){
echo "</div>";
}
}
function indexDisplay($node, $index, $tab){
//cast the function to execute on the label
if($node != 'root'){
nodeAndIndexDisplay($node, $index, $tab);
}
//serch for label's sons
$getLabels = mysql_query("SELECT * FROM labels WHERE labelParent='" . $index . "'");
if(!$getLabels){
}else{
while($row = mysql_fetch_array($getLabels)) {
indexDisplay($row[labelName], $row[labelID], $row[labelTab]);
}
}
}
?>
<body>
<?php
mysql_query("BEGIN");
if(isset($_POST[sCode])){
echo "<span class=\"BlockHeader\"><span>" . _T("FAQs") . "</span></span>";
echo "<div style=\"border: solid 1px gray;\"><a name=\"index\"><h1>" . _T("INDEX") . "</h1></a>";
indexDisplay('root', '1', '0');
echo "</div>";
questionsDisplay('root', '1', '0');
}
mysql_query("COMMIT");
?>
</body>
</html>