Portal einrichten |
|
ALoha, ich für das hier mal einfach grad weiter... hab da so meine Probleme mit ner Portalbox...
Also eigentlich will ich ne neue machen... (dreht sich übrigens ums HM-Portal)
Im Prinzip bräuchte ich die
HM-Portal - Umfrage-Automatik-Box
mit mehrfachauswahl für alle Foren... und vllt ne Begrenzung auf 'die 3 neusten Umfragen' oder so...
Ausserdem will ich die Abstimmung nicht grafisch angezeigt bekommen.
Wenns ginge die Verlinkung (Umfragetitel) als 'tablea'
und das Ergebnis im 'tableb' dadrunter, allerdings nicht grafisch, sondern
Option1: x% ; Option 2: x% ; Option 3 ... als Text.
Das '...' da soll hier nicht für usw stehen sondern auch als Text!
So dass halt nur die ersten 2 Optionen mit Ergebnis (prozentual) in der Zeile stehen, die dritte Option (sofern vorhanden) OHNE Ergebnis und danach das '...', falls noch mehr als 2 Optionen (also das dritte Ergebnis und weitere Optionen) existieren.
Hat man nur 2 Optionen fällt die 3. und das '...' natürlich komplett weg...
^^hab mir nun schon 3x das portal auf meim Testboard kapuut gespielt und komme einfach nicht zu was brauchbarem *seufz*...
__________________
|
|
01.07.2012 12:48 |
|
|
|
Super - danke dir schonmal ^^
__________________
|
|
01.07.2012 15:33 |
|
|
|
Na das sieht doch super aus...
Dann warte ich nun mal voller Freude auf die Anleitung^^ :D
__________________
|
|
13.08.2012 17:08 |
|
|
haumi
Boardbetreiber
[meine Galerie]
Dabei seit: 06.06.2009
Beiträge: 3.442
Herkunft: NRW
Postid: 12138
|
|
ANLEITUNG: (ich hoffe ich habe nichts vergessen)
Führe im acp folgende SQL-Abfrage durch:
ALTER TABLE bb1_boards ADD umfrage tinyint 1 AFTER isboard;
öffne acp/template/board.htm und suche:
code: |
1:
2:
|
<tr class="tblsection">
<td colspan="2">{$lang->items['LANG_ACP_BOARD_CLASSIFICATION']}</td> |
|
füge darüber ein:
code: |
1:
2:
3:
4:
5:
6:
7:
|
<tr class="secondrow">
<td><b>{$lang->items['LANG_ACP_BOARD_UMFRAGE']}</b></td>
<td><select name="umfrage">
<option value="1"$sel_umfrage[1]>{$lang->items['LANG_ACP_GLOBAL_YES']}</option>
<option value="0"$sel_umfrage[0]>{$lang->items['LANG_ACP_GLOBAL_NO']}</option>
</select></td>
</tr> |
|
erstelle eine neue Sprachvariable
Kategorie: acp_board
Sprachvariable: LANG_ACP_BOARD_UMFRAGE
Textinhalt: Soll das Forum bei den Umfragen eingebunden werden?
Öffne board.php und suche:
code: |
1:
|
$db->query("INSERT INTO bb".$n."_boards (styleid,parentid,parentlist,childlist,boardorder,title,password,description,ficon,prefixuse,prefixrequired,prefix,threadtemplateuse,threadtemplate,posttemplateuse,posttemplate,allowratings,daysprune,sortfield,sortorder,threadsperpage,postsperpage,postorder,countuserposts,hotthread_reply,hotthread_view,moderatenew,enforcestyle,closed,isboard, |
|
füge dahinter ein
suche weiter:
code: |
1:
|
"VALUES ('".intval($style_set)."','$parentid','$parentlist','0','".intval($boardorder)."','".addslashes($title)."','".addslashes($password)."','".addslashes($description)."','".addslashes($ficon)."','".intval($prefixuse)."','".intval($prefixrequired)."','".addslashes($prefix)."','".intval($threadtemplateuse)."','".addslashes($threadtemplate)."','".intval($posttemplateuse)."','".addslashes($posttemplate)."','".intval($allowratings)."','".intval($daysprune)."','".addslashes($sortfield)."','".addslashes($sortorder)."','".intval($threadsperpage)."','".intval($postsperpage)."','".intval($postorder)."','".intval($countuserposts)."','".intval($hotthread_reply)."','".intval($hotthread_view)."','".(($moderatenewthreads == 1) ? ("1") : ("0")).(($moderatenewposts == 1) ? ("1") : ("0"))."','".intval($enforcestyle)."','".intval($closed)."','".intval($isboard)."', |
|
füge dahinter ein
code: |
1:
|
'".intval($umfrage)."', |
|
suche weiter:
code: |
1:
|
"threadsperpage='".intval($threadsperpage)."', postsperpage='".intval($postsperpage)."', postorder='".intval($postorder)."', countuserposts='".intval($countuserposts)."', hotthread_reply='".intval($hotthread_reply)."', hotthread_view='".intval($hotthread_view)."', moderatenew='".(($moderatenewthreads == 1) ? ("1") : ("0")).(($moderatenewposts == 1) ? ("1") : ("0"))."', enforcestyle='".intval($enforcestyle)."', closed='".intval($closed)."', isboard='".intval($isboard)."', |
|
füge dahinter ein:
code: |
1:
|
umfrage='".intval($umfrage)."', |
|
suche weiter:
code: |
1:
|
$sel_isboard[$board['isboard']] = " selected="selected""; |
|
füge dadrunter ein:
code: |
1:
|
$sel_umfrage[$board['umfrage']] = " selected="selected""; |
|
speichern!
ersetze den gesamten Inhalt der Datei: hm-portal/box_poll.php mit folgendem Code:
code: |
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:
|
<?
if(!(@hmp_check())) exit();
//
// HM-Portal 3.1
// box_poll.php
// Show a poll in the portal
// Don't confuse this box with the autopoll box (box_autopoll.php)
//
eval("print("".$hm_boxhead_tpl."");");
// read poll number
//$pollid = $hmpopt['pollid'];
$auswahl = mysql_query("SELECT boardid FROM bb1_boards WHERE umfrage ='1'");
while($wahl = mysql_fetch_array($auswahl)) {
$neu[] = $wahl['boardid'];
}
$nummer = implode(",", $neu);
$files = mysql_query("SELECT p.* FROM bb1_polls p
INNER JOIN bb1_threads t
ON p.threadid = t.threadid
INNER JOIN bb1_boards b
ON t.boardid = b.boardid
where b.boardid IN($nummer)
ORDER BY p.starttime DESC
LIMIT 3");
while($poll = mysql_fetch_array($files)) {
$pollid = $poll[0];
$poll = $db->query_first("SELECT * FROM bb".$n."_polls WHERE pollid='$pollid'");
if (!$poll['pollid']) {
eval("print("".$tpl->get("hm_box_poll_none")."");");
eval("print("".$hm_boxtail_tpl."");");
return;
}
$poll['question'] = htmlconverter($poll['question']);
// calculate timeout
if ($poll['timeout']==0) $timeout=time()+1;
else $timeout=$poll['starttime']+$poll['timeout']*86400;
// already voted?
if((!isset($_REQUEST['preresult']) || $_REQUEST['preresult']!=$pollid) && checkpermissions("can_vote_poll")==1 && $timeout>=time()) {
if($wbbuserdata['userid']) $votecheck=$db->query_first("SELECT id AS pollid FROM bb".$n."_votes WHERE id='$pollid' AND votemode=1 AND userid='$wbbuserdata[userid]'");
else $votecheck=$db->query_first("SELECT id AS pollid FROM bb".$n."_votes WHERE id='$pollid' AND votemode=1 AND ipaddress='$REMOTE_ADDR'");
}
if((isset($_REQUEST['preresult']) && $_REQUEST['preresult']==$pollid) || $votecheck['pollid'] || !checkpermissions("can_vote_poll") || $timeout<time()) {
// show result
$votes=0;
unset($polloptions);
$totalvotes=0;
$maxvotes=0;
$portal_poll_id=$poll['threadid'];
$result=$db->query("SELECT * FROM bb".$n."_polloptions WHERE pollid='$pollid' ORDER BY showorder ASC");
while($row=$db->fetch_array($result)) {
$totalvotes += $row['votes'];
$polloptions[] = $row;
if ($row['votes'] > $maxvotes) $maxvotes = $row['votes'];
}
$maxp_float = ($totalvotes) ? ($maxvotes*100/$totalvotes) : '0'; // maximale Prozent fuer die Skalierung
$i=1;
$thread_poll_resultbit = "";
while(list($key,$row) = each($polloptions)) {
if($totalvotes) {
$percent_float = $row['votes']*100/$totalvotes; // tatsaechliche Prozent
$percent = number_format($percent_float, 0); // String, auf 0 Kommastellen gekuerzt
$percent_int = floor($percent_float) * 3; // Breite in Pixeln
if ($percent_int < 1) $percent_int = 1; // mindestens 1 Pixel muss schon sein...
$percent_disp = floor($percent_float / $maxp_float * 80); // Relative Laenge
//if ($percent_disp < 1) $percent_disp = 1;
} else {
$percent = $percent_int = $percent_disp = 0;
}
$row['polloption'] = htmlconverter($row['polloption']);
eval ("\$thread_poll_resultbit .= "".$tpl->get("hm_box_poll_resultbit")."";");
if($i==5) $i=0; // color cycle
$i++;
}
eval("print("".$tpl->get("hm_box_poll_result")."");");
} else {
// show poll for voting
if($poll['choicecount']>1) $inputtype="checkbox";
else $inputtype="radio";
$thread_pollbit = "";
$result=$db->unbuffered_query("SELECT * FROM bb".$n."_polloptions WHERE pollid='$pollid' ORDER BY showorder ASC");
while($row=$db->fetch_array($result)) {
$row['polloption'] = htmlconverter(textwrap($row['polloption']));
eval ("\$thread_pollbit .= "".$tpl->get("hm_box_pollbit")."";");
}
eval ("print ("".$tpl->get("hm_box_poll")."");");
}
}
eval("print("".$hm_boxtail_tpl."");");
?> |
|
Speichern und fertig ist es.
Auch hier gilt, die Templates und php-Dateien vorher sichern!
Wenn etwas unklar sein sollte bitte hier fragen bevor man etwas falsch macht.
Es wird auch Hilfe gegeben wenn etwas nicht so ganz geklappt hat.
Urheber ist haumi - aber jeder kann es frei verwenden und nach belieben abändern.
LG
haumi
__________________
Gelassen das hinnehmen, was nicht zu ändern ist,
engagiert angehen was man gestalten kann.
|
|
13.08.2012 20:57 |
|
|
|