Haumis wbb hilfe (http://haumis-wbb-hilfe.de/wbb2/index.php)
- Veränderungen (http://haumis-wbb-hilfe.de/wbb2/board.php?boardid=15)
-- Eigene Sachen von diesem Board (http://haumis-wbb-hilfe.de/wbb2/board.php?boardid=17)
--- 2 oder mehr Mussfelder bei der Umfrage (http://haumis-wbb-hilfe.de/wbb2/thread.php?threadid=191)


Geschrieben von haumi am 01.09.2009 um 17:30:

  2 oder mehr Mussfelder bei der Umfrage

Ich wurde von einigen Grafikboards angesprochen ob man bei den Umfragen nicht vorgeben kann das 2 Antworten gegeben werden MÜSSEN.
Die jetztige Umfrage sieht nur eine oder-Funktion vor (1 oder 2 oder 3 usw.
Ich habe daraufhin die Umfrage etwas angepasst und das sieht beim Aufruf nun so aus:



Was muss gemacht werden?

Öffne pollstart.php und suche:

$db->query("INSERT INTO bb".$n."_polls (question,starttime,choicecount,timeout, idhash) VALUES ('".addslashes($question)."','".time()."','".intval($_POST['choicecount']).
"','".intval($_POST['timeout'])."','". addslashes($idhash)."')");


ersetze mit:

if($choicecountm > 0) {
$db->query("INSERT INTO bb".$n."_polls (question,starttime,choicecount,choicecountm,timeout,idhash) VALUES ('".addslashes($question)."','".time()."','".intval($_POST['choicecountm'])
."','".intval($_POST['choicecountm'])."','".intval($_POST['timeout'])."','"
.addslashes($idhash)."')");
}else{
$db->query("INSERT INTO bb".$n."_polls (question,starttime,choicecount,choicecountm,timeout,idhash) VALUES ('".addslashes($question)."','".time()."','".intval($_POST['choicecount']).
"','".intval($_POST['choicecountm'])."','".intval($_POST['timeout'])."','".
addslashes($idhash)."')");
}


suche weiter:

$choicecount = 1;

füge darunter ein:

$choicecountm = 0;

speichern.

Öffne pollvote.php und suche:

if (count($_POST['polloptionid']) > $poll['choicecount']) error($lang->get("LANG_MISC_POLLVOTE_ERROR3", array('$choicecount' => $poll['choicecount'])));

ersetze mit:

if ($poll['choicecountm']>0) {
$poll['choicecount']=$poll['choicecountm'];
if (count($_POST['polloptionid'])!= $poll['choicecountm']) error($lang->get("LANG_MISC_POLLVOTE_ERROR5", array('$choicecount' => $poll['choicecount'])));
}
else {
if (count($_POST['polloptionid']) > $poll['choicecount']) error($lang->get("LANG_MISC_POLLVOTE_ERROR3", array('$choicecount' => $poll['choicecount'])));
}


speichern

Öffne polledit.php und suche:

$db->unbuffered_query("UPDATE bb".$n."_polls SET question='".addslashes($_REQUEST['question'])."', choicecount='".addslashes($_REQUEST['choicecount'])."', timeout='".addslashes($_REQUEST['timeout'])."' WHERE pollid='$pollid'");

ersetze mit:

if($choicecountm > 0) {
$db->unbuffered_query("UPDATE bb".$n."_polls SET question='".addslashes($_REQUEST['question'])."', choicecount='".addslashes($_REQUEST['choicecountm'])."', choicecountm='".addslashes($_REQUEST['choicecountm'])."', timeout='".addslashes($_REQUEST['timeout'])."' WHERE pollid='$pollid'");
} else{
$db->unbuffered_query("UPDATE bb".$n."_polls SET question='".addslashes($_REQUEST['question'])."', choicecount='".addslashes($_REQUEST['choicecount'])."', timeout='".addslashes($_REQUEST['timeout'])."' WHERE pollid='$pollid'");
}


suche weiter:

$choicecount = $poll['choicecount'];

füge darunter ein:

$choicecountm = $poll['choicecountm'];

suche weiter:

$choicecount = intval($_REQUEST['choicecount']);

füge darunter ein:

$choicecountm = intval($_REQUEST['choicecountm']);

speichern


Öffne template pollstart und suche

<tr align="left">
<td class="tablea"><span class="normalfont"><b>{$lang->items['LANG_POLL_CHOICECOUNT']}</b></span></t
d>
<td class="tablea"><input type="text" name="choicecount" value="$choicecount" class="input" size="10" maxlength="2" /><span class="smallfont"> {$lang->items['LANG_POLL_CHOICECOUNT_DESC']}</span></td>
</tr>


füge darunter ein:

<tr align="left">
<td class="tablea"><span class="normalfont"><b>{$lang->items['LANG_POLL_CHOICECOUNT_M']}</b></span><
/td>
<td class="tablea"><input type="text" name="choicecountm" value="$choicecountm" class="input" size="10" maxlength="2" /><span class="smallfont"> {$lang->items['LANG_POLL_CHOICECOUNT_DESC_M']}</span></td>
</tr>


speichern

öffne template polledit und suche:

<tr align="left">
<td class="tablea"><span class="normalfont"><b>{$lang->items['LANG_POLL_CHOICECOUNT']}</b></span></t
d>
<td class="tablea"><input type="text" name="choicecount" value="$choicecount" class="input" size="10" maxlength="2" /><span class="smallfont"> {$lang->items['LANG_POLL_CHOICECOUNT_DESC']}</span></td>
</tr>


füge darunter ein

<tr align="left">
<td class="tablea"><span class="normalfont"><b>{$lang->items['LANG_POLL_CHOICECOUNT_M']}</b></span><
/td>
<td class="tablea"><input type="text" name="choicecountm" value="$choicecountm" class="input" size="10" maxlength="2" /><span class="smallfont"> {$lang->items['LANG_POLL_CHOICECOUNT_DESC_M']}</span></td>
</tr>


speichern

erstelle drei Sprachvariablen:

Kategorie: misc
Sprachvariable: LANG_MISC_POLLVOTE_ERROR5
Textinhalt: Sie müssen $choicecount Optionen ausw&auml;hlen. Bitte korrigieren Sie die Anzahl auf $choicecount Optionen

Kategorie: poll
Sprachvariable: LANG_POLL_CHOICECOUNT_DESC_M
Textinhalt: (Geben Sie bitte an, wie viel Optionen ausgewählt werden müssen!)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Bei "0" gilt die Mehrfachauswahl - KANN?:)


Kategorie: poll
Sprachvariable: LANG_POLL_CHOICECOUNT_DESC_ M
Textinhalt: (Geben Sie bitte an, wie viel Optionen ausgewählt werden müssen!)

Kategorie: poll
Sprachvariable: LANG_POLL_CHOICECOUNT_M
Textinhalt: Mehrfachauswahl - MUSS?:



Ändere den Textinhalt folgender Sprachvariabe:

Kategorie: poll
Sprachvariable: LANG_POLL_CHOICECOUNT
Textinhalt: Mehrfachauswahl - KANN?:


Führe folgende Abfrage durch:

ALTER TABLE `bb1_polls` ADD `choicecountm` TINYINT(3) unsigned NOT NULL AFTER `choicecount` ;

und fertig


Auch hier gilt wie immer:
alle zu ändernden templates und php-Dateien vorher sichern,
damit man bei einem Fehler den alten Zustand wieder herstellen kann!!
Eine Garantie wird auch nicht übernommen.

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



Geschrieben von samurai am 02.09.2009 um 13:36:

 

so Weit ok =)
ich werde es mal Lokal durch testen und dan in einer anleitung zusammen fassen bzw. evtl. html *g*


Forensoftware: Burning Board 2.3.6, entwickelt von WoltLab GmbH