ezPortal & Umfrageblock

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Benutzeravatar
Dungeonwatcher
Beiträge: 1055
Registriert: Sa 19.Feb, 2005 01:16
Wohnort: Berlin
Kontaktdaten:

ezPortal & Umfrageblock

Beitrag von Dungeonwatcher »

Deine phpBB Version: 2.0.15
Typ Deines phpBB Forums: Standard phpBB (auch Vanilla genannt)
MODs: Ja
Dein Wissensstand: Einsteiger
Link zu Deinem Forum: http://dungeon-bbs.fidosoft.de/forum/

PHP Version:
MySQL Version:


Was hast Du gemacht, bevor das Problem aufgetreten ist?



Was hast Du bereits versucht um das Problem zu lösen?
diverse Supportforen durchsucht



Fehlerbeschreibung und Nachricht

Hi! :cool:

Damit es nicht langweilig wird noch ein Schönheitsfehler. ^d

Der Umfrageblock im ezPortal ist zwar ganz schön, nur leider hat er Zwei Schönheitsfehler. Zum einen sehen Gäste und nicht eingeloggte Benutzer das Umfrageergebnis bereits anhand der Zahlen hinter den Antworten. Zum anderen sieht ein eingeloggter Benutzer obwohl er bereits abgestimmt hat nicht das Endergebnis als Grafik, sondern bekommt wieder die Frage gestellt. :confused:

Auf www.phpbb.de wurde dies zwar schon einige Male angesprochen, aber eine Lösung habe ich dort nicht gefunden.

Wie bekomme ich es hin, das Gäste die Frage (ohne bisherige Antworten) sehen und eingeloggte Benutzer, je nach dem ob sie abgestimmt haben oder nicht, die Frage (ohne Antwort) oder das Ergebnis als Grafik?

Bye/2
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Hier mein Block der portal.php:

Code: Alles auswählen

// Set the vote graphic length to 100
// 	Note: If the bars look too long at %100, (only 1 vote) set this value lower.
// 	      Likewise, if it looks too short to you, increase it here.
$length = 100;

//  Get the poll forum from EZportal config above
$poll_forum = $CFG['poll_forum'];

$sql = 'SELECT
	  t.*, vd.*
	FROM
	  ' . TOPICS_TABLE . ' AS t,
	  ' . VOTE_DESC_TABLE . ' AS vd
	WHERE
	  t.forum_id = ' . $poll_forum . ' AND
	  t.topic_status <> 1 AND
	  t.topic_status <> 2 AND
	  t.topic_vote = 1 AND
	  t.topic_id = vd.topic_id
	ORDER BY
	  t.topic_time DESC
	LIMIT
	  0,1';


if(!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, "Couldn't obtain poll information.", "", __LINE__, __FILE__, $sql);
}

if(!$total_posts = $db->sql_numrows($result))
{
	message_die(GENERAL_MESSAGE, $lang['No_posts_topic']);
}
$pollrow = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);

$topic_id = $pollrow[0]['topic_id'] ;

$sql = "SELECT pt.bbcode_uid FROM " . TOPICS_TABLE . " t, " . POSTS_TEXT_TABLE . " pt
	WHERE t.topic_id = $topic_id
		AND t.topic_first_post_id = pt.post_id
	LIMIT 1";
if (!$result = $db->sql_query($sql))
{
	message_die(GENERAL_ERROR, 'Could not read bbcode for poll_options', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$bbcode_uid = $row['bbcode_uid'];
$db->sql_freeresult($result);

$sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vd.vote_max, vd.vote_voted, vd.vote_hide, vd.vote_tothide, vr.vote_option_id, vr.vote_option_text, vr.vote_result
	FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr
	WHERE vd.topic_id = $topic_id
		AND vr.vote_id = vd.vote_id
	ORDER BY vr.vote_option_id ASC";
if( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, "Couldn't obtain vote data for this topic", "", __LINE__, __FILE__, $sql);
}

if( $vote_options = $db->sql_numrows($result) )
{
	$vote_info = $db->sql_fetchrowset($result);

	$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;

	if ( $poll_expired == 0 )
	{
		$vote_id = $vote_info[0]['vote_id'];
		$vote_title = $vote_info[0]['vote_text'];
		$max_vote = $vote_info[0]['vote_max'];
		$voted_vote = $vote_info[0]['vote_voted'];
		$hide_vote = $vote_info[0]['vote_hide'];
		$tothide_vote = $vote_info[0]['vote_tothide'];

		$sql = "SELECT vote_id
			FROM " . VOTE_USERS_TABLE . "
			WHERE vote_id = $vote_id
				AND vote_user_id = " . $userdata['user_id'];
		if( !$result = $db->sql_query($sql) )
		{
			message_die(GENERAL_ERROR, "Couldn't obtain user vote data for this topic", "", __LINE__, __FILE__, $sql);
		}

		$user_voted = ( $db->sql_numrows($result) ) ? TRUE : 0;

		if( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) )
		{
			$view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == "viewresult" ) ? TRUE : 0;
		}
		else
		{
			$view_result = 0;
		}

		$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;

		if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED )
		{

			$template->set_filenames(array(
				"pollbox" => "portal_poll_result.tpl")
			);

			$vote_results_sum = 0;

			for($i = 0; $i < $vote_options; $i++)
			{
				$vote_results_sum += $vote_info[$i]['vote_result'];
			}

			$vote_graphic = 0;
			$vote_graphic_max = count($images['voting_graphic']);

			for($i = 0; $i < $vote_options; $i++)
			{
				$vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0;
				$vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']);

				$vote_graphic_img = $images['voting_graphic'][$vote_graphic];
				$vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0;

				if ( count($orig_word) && ($forum_topic_data['disable_word_censor'] == 0) )
				{
					$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
				}

				$hide_vote_bl = '';
				$hide_vote_zr = '0';
				$total_votes_1 = $lang['Total_votes'] ;
				$total_votes_2 = $vote_results_sum ;
				if ( ( $poll_expired == 0 ) && ( $hide_vote == 1 ) && ( $vote_info[0]['vote_length'] <> 0 ) )
				{
					if ( $tothide_vote == 1 )
					{
						$total_votes_1 = '' ;
						$total_votes_2 = '' ;
					}
					$poll_expires_c = $lang['Results_after'];
					$template->assign_block_vars("poll_option", array(
						'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'],
						'POLL_OPTION_RESULT' => $hide_vote_bl,
						'POLL_OPTION_PERCENT' => $hide_vote_bl,
						'POLL_OPTION_IMG' => $vote_graphic_img,
						'POLL_OPTION_IMG_WIDTH' => $hide_vote_zr)
					);
				}
				else
				{
					$poll_expires_c = '';

					$vote_caption_text = $vote_info[$i]['vote_option_text'];
					$vote_caption_text = (!$board_config['allow_html']) ? preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $vote_caption_text) : $vote_caption_text;
					$vote_caption_text = ($board_config['allow_bbcode'] && $bbcode_uid != '') ? bbencode_second_pass($vote_caption_text, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $vote_caption_text);
					$vote_caption_text = make_clickable($vote_caption_text);
					$vote_caption_text = ($board_config['allow_smilies']) ? smilies_pass($vote_caption_text) : $vote_caption_text;

					$template->assign_block_vars("poll_option", array(
						'POLL_OPTION_CAPTION' => $vote_caption_text,
						'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'],
						'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)),

						'POLL_OPTION_IMG' => $vote_graphic_img,
						'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length)
					);
				}
			}

			$template->assign_vars(array(
				'L_TOTAL_VOTES' => $total_votes_1,
				"TOTAL_VOTES" => $total_votes_2,
				"L_VIEW_RESULTS" => $lang['View_results'],
				"U_VIEW_RESULTS" => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult"))
			);

		}
		else
		{
			$template->set_filenames(array(
				"pollbox" => "portal_poll_ballot.tpl")
			);

			for($i = 0; $i < $vote_options; $i++)
			{
				if( count($orig_word) )
				{
					$vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']);
				}

				$vote_caption_text = $vote_info[$i]['vote_option_text'];
				$vote_caption_text = (!$board_config['allow_html']) ? preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $vote_caption_text) : $vote_caption_text;
				$vote_caption_text = ($board_config['allow_bbcode'] && $bbcode_uid != '') ? bbencode_second_pass($vote_caption_text, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $vote_caption_text);
				$vote_caption_text = make_clickable($vote_caption_text);
				$vote_caption_text = ($board_config['allow_smilies']) ? smilies_pass($vote_caption_text) : $vote_caption_text;

				$template->assign_block_vars("poll_option", array(
					"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
					"POLL_OPTION_CAPTION" => $vote_caption_text)
				);
			}
			$template->assign_vars(array(
				"LOGIN_TO_VOTE" => '<b><a href="' . append_sid("login.$phpEx?redirect=portal.$phpEx") . '">' . $lang['Login_to_vote'] . '</a><b>')
			);

			$s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">';
		}

		if( count($orig_word) )
		{
			$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
		}

		$template->assign_vars(array(
			"POLL_QUESTION" => $vote_title,
			"L_SUBMIT_VOTE" => $lang['Submit_vote'],
			"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
			"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=vote"))
		);

		$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
	}
}
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
Dungeonwatcher
Beiträge: 1055
Registriert: Sa 19.Feb, 2005 01:16
Wohnort: Berlin
Kontaktdaten:

Beitrag von Dungeonwatcher »

Oohhh, Danke. :cool:

Das ergibt hier leider:
SQL Error : 1054 Unbekanntes Tabellenfeld 'vd.vote_max' in field list.

SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vd.vote_max, vd.vote_voted, vd.vote_hide, vd.vote_tothide, vr.vote_option_id, vr.vote_option_text, vr.vote_result FROM phpbb_vote_desc vd, phpbb_vote_results vr WHERE vd.topic_id = 318 AND vr.vote_id = vd.vote_id ORDER BY vr.vote_option_id ASC
Fehlt mir da ein Mod?

Nachtrag:

Das dürfte wohl der Multi Vote Mod sein? Mit dessen hilfe habe ich die fehlenden Tabellenfelder erstellt und bekomme jetzt dafür:

--> Template->make_filename(): Error - file portal_poll_result.tpl does not exist

Dieses Template ist aber auch im Multi Vote Mod nicht enthalten?

Nachtrag 2:

Das Template habe ich jetzt auch gefunden und in den Inhalt in die portal.tpl eingefügt. Aber das Ergebnis sieht noch bescheiden aus. Zwei Schönheitsfehler fallen sofort auf:

Es fehlt an den Balken der runde Anfang bzw. das runde Ende. Der IE von M$ zeigt trotz 0% einen ca. 1 Pixel großen Balken an?
Zuletzt geändert von Dungeonwatcher am So 19.Jun, 2005 19:11, insgesamt 2-mal geändert.
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Hier die beiden fehlenden TPL's.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
volker58
Beiträge: 724
Registriert: Mo 27.Dez, 2004 19:22
Wohnort: Annaberg-Buchholz
Kontaktdaten:

Beitrag von volker58 »

[quote="oxpus";p="36181"]Hier die beiden fehlenden TPL's.[/quote]

kannste die bitte nochmal anhängen?

//EDIT

mir ist nochwas aufgefallen, wenn du umfrage abgelaufen ist, bekomme ich keine anzeige mehr im portal, also die ganze box ist verschwunden. ich häng mal meiene portal mit ran

[ Attachment gelöscht am Di 06.Feb, 2007 14:34 von oxpus ]
Zuletzt geändert von volker58 am Di 06.Feb, 2007 13:50, insgesamt 1-mal geändert.
Gruss Volker

http://www.fuchsienfreunde.de
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

mir ist nochwas aufgefallen, wenn du umfrage abgelaufen ist, bekomme ich keine anzeige mehr im portal, also die ganze box ist verschwunden
Ja, das ist Absicht und kein Fehler!
kannste die bitte nochmal anhängen?
Sorry, ich habe die nicht mehr. Bei mir wird keine Umfrage mehr im Portal angezeigt und daher sind auch die TPLs bei mir gelöscht...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
volker58
Beiträge: 724
Registriert: Mo 27.Dez, 2004 19:22
Wohnort: Annaberg-Buchholz
Kontaktdaten:

Beitrag von volker58 »

Ja, das ist Absicht und kein Fehler!
wie kann ich das ändern?
Gruss Volker

http://www.fuchsienfreunde.de
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Welche von den Umfragen soll denn angezeigt werden?
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
volker58
Beiträge: 724
Registriert: Mo 27.Dez, 2004 19:22
Wohnort: Annaberg-Buchholz
Kontaktdaten:

Beitrag von volker58 »

eigendlich immer die letzte
Gruss Volker

http://www.fuchsienfreunde.de
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Dann muss ich Deine portal.php haben, um das einzurichten.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
volker58
Beiträge: 724
Registriert: Mo 27.Dez, 2004 19:22
Wohnort: Annaberg-Buchholz
Kontaktdaten:

Beitrag von volker58 »

natürlich, hier ist sie nochmal

bitte mit anleitung was du änderst
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Gruss Volker

http://www.fuchsienfreunde.de
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Voilá:

Code: Alles auswählen

#
#-----[ OPEN ]-----
#
portal.php

#
#-----[ FIND ]-----
#
	$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;

	if ( $poll_expired == 0 )
	{

#
#-----[ REPLACE, WITH ]-----
#
	$poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0;

#
#-----[ FIND ]-----
#
		$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
	}
} 

#
#-----[ REPLACE, WITH ]-----
#
		$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
} 
Sollte so funktionieren...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Benutzeravatar
volker58
Beiträge: 724
Registriert: Mo 27.Dez, 2004 19:22
Wohnort: Annaberg-Buchholz
Kontaktdaten:

Beitrag von volker58 »

vielen dank, geht eigendlich soweit ich sehen kann. nun bastel ich noch bissel an den tpl´s :)
Gruss Volker

http://www.fuchsienfreunde.de
Antworten