Seite 1 von 1

Multivote & Intro & Portal MOD

Verfasst: 10.07.2006 16:44
von Markus67
Hi ...

besteht eigentlich Interesse für eine Anpassung vom Intro & Portal MOD damit dort auch der Multivote MOD 1.4.2 angezeigt wird?

Ich habe das bei mir realisiert und falls jemand Interesse hat würde ich dafür eine Anleitung schreiben :wink:

Markus

Verfasst: 10.07.2006 17:01
von cool_Torsten
Hi Markus, ja würde mich interessieren, hab auch den Multivote-Mod und den AWSW Intro & Portal Mod. Wär ne gute Sache denk ich.. :wink:

MfG cool_Torsten

Verfasst: 11.07.2006 10:17
von Markus67
Hi ...

na dann wollen wir mal ... und bitte vorher Sicherungskopien erstellen :wink:

suche in der portal.php:

Code: Alles auswählen

		'L_POLL' => $lang['Topic_Poll'],
		'L_VOTE_BUTTON' => $lang['Submit_vote'],
ersetze mit:

Code: Alles auswählen

		'L_POLL' => $lang['Poll'],
		'L_VOTE_BUTTON' => $lang['Vote'],
suche:

Code: Alles auswählen

// FETCH POLL START
...
...
...
...
// FETCH POLL END
ersetze mit:

Code: Alles auswählen

	// FETCH POLL START
	if( $introportalmod_config['pollbox_active'] == "1" )
	{

	// 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 = 65;
	
	$CFG['poll_forum'] =  $introportalmod_config['pollbox_forums'];

	if( $CFG['poll_forum'] > 0)

	{
		$poll_forum = $CFG['poll_forum'];
		$template->assign_block_vars('PORTAL_POLL', array());
	
		$sql = 'SELECT t.*, vd.*
			FROM ' . TOPICS_TABLE . ' AS t, ' . VOTE_DESC_TABLE . ' AS vd
			WHERE 
			  t.forum_id IN (' . $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);

		}
	
		$total_polls = $db->sql_numrows($result);
	
		$pollrow = $db->sql_fetchrowset($result);
		$db->sql_freeresult($result);
	
		if ( $total_polls != 0 )
		{
		$topic_id = $pollrow[0]['topic_id'] ;
	
			$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);
	
				$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;
				$db->sql_freeresult($result);
	
				if( isset($_GET['vote']) || isset($HTTP_POST_VARS['vote']) )
				{
					$view_result = ( ( ( isset($_GET['vote']) ) ? $_GET['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 || $forum_row['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;
						$portal_vote_graphic_length = round($vote_percent * $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) )
						{
							$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 = '';
	
						$template->assign_block_vars("poll_option", array(
							"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_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" => $portal_vote_graphic_length/1)
						);
					}
					}
	
	         			if ( ( $poll_expired == 0 ) && ( $vote_info[0]['vote_length'] <> 0 ) ) 
	         			{ 
	            				$poll_expire_1 = (( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] ) - time() ); 
	            				$poll_expire_2 = intval($poll_expire_1/86400); 
	            				$poll_expire_a = $poll_expire_2*86400; 
	            				$poll_expire_3 = intval(($poll_expire_1 - ($poll_expire_a))/3600); 
	            				$poll_expire_b = $poll_expire_3*3600; 
	            				$poll_expire_4 = intval((($poll_expire_1 - ($poll_expire_a) - ($poll_expire_b)))/60); 
	            				$poll_comma = ', '; 
	            				$poll_space = ' '; 
	           	 			$poll_expire_2 == '0' ? $poll_expire_6='' : ( ( $poll_expire_3 == 0 && $poll_expire_4 == 0 ) ? $poll_expire_6=$poll_expire_2.$poll_space.$lang['Days'] : $poll_expire_6=$poll_expire_2.$poll_space.$lang['Days'].$poll_comma ) ; 
	            				$poll_expire_3 == '0' ? $poll_expire_7='' : ( $poll_expire_4 == 0 ? $poll_expire_7=$poll_expire_3.$poll_space.$lang['Hours'] : $poll_expire_7=$poll_expire_3.$poll_space.$lang['Hours'].$poll_comma ) ; 
	            				$poll_expire_4 == '0' ? $poll_expire_8='' : $poll_expire_8=$poll_expire_4.$poll_space.$lang['Minutes'] ; 
	            				$poll_expires_d = $lang['Poll_expires']; 
	         			} 
	         			else if ($poll_expired == 1) 
	         			{ 
	            				$poll_expires_6 = ''; 
	            				$poll_expires_7 = ''; 
	            				$poll_expires_8 = ''; 
	            				$poll_expires_d = $lang['Poll_expiredyes']; 
	         			} 
	         			else 
	         			{ 
	            				$poll_expires_6 = ''; 
	            				$poll_expires_7 = ''; 
	            				$poll_expires_8 = ''; 
	            				$poll_expires_d = $lang['Poll_noexpire']; 
	         			} 
	         			$voted_vote_nb = $voted_vote; 
	         			$template->assign_vars(array( 
	            				"VOTED_SHOW" => $lang['Voted_show'], 
	            				"L_TOTAL_VOTES" => $total_votes_1, 
	            				"L_RESULTS_AFTER" => $poll_expires_c, 
	            				"L_POLL_EXPIRES" => $poll_expires_d, 
	            				"POLL_EXPIRES" => ($poll_expire_6.$poll_expire_7.$poll_expire_8), 
	            				"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")
					);
	
	         			if ( $max_vote > 1 ) 
	         			{ 
	            				$vote_box = 'checkbox'; 
	         			} 
	         			else    $vote_box = 'radio';
	
					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']);
						}
	
						$template->assign_block_vars("poll_option", array(
							"POLL_VOTE_BOX" => $vote_box,
							"POLL_OPTION_ID" => $vote_info[$i]['vote_option_id'],
							"POLL_OPTION_CAPTION" => $vote_info[$i]['vote_option_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 ( ( $max_vote > 1 ) && ( $max_vote < $vote_options ) ) 
	            		{ 
	            		   $vote_br = '<br/>'; 
	            		   $max_vote_nb = $max_vote; 
	            		} 
	            		else 
	            		{ 
	            		   $vote_br = ''; 
	            		   $lang['Max_voting_1_explain'] = ''; 
	            		   $lang['Max_voting_2_explain'] = ''; 
	            		   $lang['Max_voting_3_explain'] = ''; 
	            		   $max_vote_nb = ''; 
	            		}
	
				if( count($orig_word) )
				{
					$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
				}
	
				$template->assign_vars(array(
					"POLL_QUESTION" => '<b>'.$vote_title.'</b>',
	         			"POLL_VOTE_BR" => $vote_br, 
	         			"MAX_VOTING_1_EXPLAIN" => $lang['Max_voting_1_explain'], 
	         			"MAX_VOTING_2_EXPLAIN" => $lang['Max_voting_2_explain'], 
	         			"MAX_VOTING_3_EXPLAIN" => $lang['Max_voting_3_explain'], 
	         			"max_vote" => $max_vote_nb, 
	         			"voted_vote" => $voted_vote_nb,
					"L_SUBMIT_VOTE" => '<input type="submit" name="submit" value="'.$lang['Submit_vote'].'" class="liteoption" />',
					"S_HIDDEN_FIELDS" => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : "",
					"S_POLL_ACTION" => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id"))
				);
	
				$template->assign_var_from_handle("PORTAL_POLL", "pollbox");
			}
		}
		else
		{
			$template->set_filenames(array(
				"pollbox" => "portal_poll_ballot.tpl")
			);

			$template->assign_vars(array(
				"POLL_QUESTION" => $lang['No_poll'],
				"L_SUBMIT_VOTE" => '',
				"S_HIDDEN_FIELDS" => "",
				"S_POLL_ACTION" => '',
				"LOGIN_TO_VOTE" => '')
			);

			$template->assign_var_from_handle("PORTAL_POLL", "pollbox");

		}
	
	}
	

	$template->assign_block_vars('switch_pollbox_active', array());
}

if( $userdata['session_logged_in'] && $introportalmod_config['pollbox_active'] == "1" )
{
	$template->assign_block_vars('switch_pollbox_active_in', array());
}

// FETCH POLL END
suche in per portal_body.tpl

Code: Alles auswählen

<!-- ##### FETCH POLL START ##### -->
<!-- BEGIN switch_pollbox_active -->
<table width="100%" border="0" cellpadding="1" cellspacing="1" style="border-collapse: collapse" class="forumline">
  <tr>
        <td class="catHead" colspan="2" height="25"><span class="cattitle"><center><b>{IntroPortaltext18}:</b></center></span></td>
  </tr>

  <tr>
        <td colspan="2" height="1" class="row3"><img src="images/spacer.gif" width="1" height="1" alt="."></td>
  </tr>
		   <tr>
			<td class="row1" align="center"><span class="gensmall">
				<form method="post" action="{S_POLL_ACTION}">
				<br><center><b>{S_POLL_QUESTION}</b></center><br />
<!-- END switch_pollbox_active -->
				<!-- BEGIN poll_option_row -->
				&nbsp;&nbsp;&nbsp;
				<input align="middle" type="radio" name="vote_id" value="{poll_option_row.OPTION_ID}">{poll_option_row.OPTION_TEXT}&nbsp;[{poll_option_row.VOTE_RESULT}]<br />
				<!-- END poll_option_row -->
<!-- BEGIN switch_pollbox_active_in -->
				<br /><center><input type="submit" class="mainoption" name="submit" value="{L_VOTE_BUTTON}" {DISABLED}></center>
<!-- END switch_pollbox_active_in -->
<!-- BEGIN switch_pollbox_active -->
				<input type="hidden" name="topic_id" value="{S_TOPIC_ID}">
				<input type="hidden" name="mode" value="vote">
				<br><span class="gensmall"><b><a href="viewtopic.php?t={S_TOPIC_ID}&postdays=0&postorder=asc&vote=viewresult" class="gensmall">{L_RESULT}</a></b></span>
				</form>
			</span></td>
		   </tr>
		  </table><br>
<!-- END switch_pollbox_active -->
<!-- ##### FETCH POLL END ##### -->
ersetze mit:

Code: Alles auswählen

<!-- ##### FETCH POLL START ##### -->
<!-- BEGIN switch_pollbox_active -->

{PORTAL_POLL}

<!-- END switch_pollbox_active -->
<!-- ##### FETCH POLL END ##### -->
Den nachfolgenden Code speichern -> portal_poll_ballot.tpl und in den Ordner templates/dein_template/ hochladen

Code: Alles auswählen

<table width="100%" border="0" cellpadding="1" cellspacing="1" class="forumline">
	<tr>
		<th>{L_POLL}</th>
	</tr>
	<tr>
		<td class="row2"><br clear="all" />
			<form style="display:inline" method="POST" action="{S_POLL_ACTION}">
			<table width="100%" cellspacing="0" cellpadding="4" border="0" align="center">
				<tr> 
					<td class="row2" align="center"><span class="gensmall" style="color: #8B0000"><b>{MAX_VOTING_1_EXPLAIN}{max_vote}{MAX_VOTING_2_EXPLAIN}{POLL_VOTE_BR}</b></span><span class="gensmall">{MAX_VOTING_3_EXPLAIN}{POLL_VOTE_BR}{POLL_VOTE_BR}</span></td> 
				</tr>
				<tr>
					<td class="row2" align="center"><span class="genmed"><b>{POLL_QUESTION}</b></span></td>
				</tr>
				<tr>
					<td align="center">
						<table width="100%" cellspacing="0" cellpadding="2" border="0">
						<!-- BEGIN poll_option -->
							<tr>
								<td width="50" align="center"><input type="{poll_option.POLL_VOTE_BOX}" name="vote_id[]" value="{poll_option.POLL_OPTION_ID}" /></td>
								<td width="100%"><span class="gensmall">{poll_option.POLL_OPTION_CAPTION}</span></td>
							</tr>
							<!-- END poll_option -->
						</table>
					</td>
				</tr>
				<tr>
					<td  class="row2" align="center">
						 <!-- BEGIN switch_user_logged_in -->
						 {L_SUBMIT_VOTE}<br /><br />
						 <!-- END switch_user_logged_in -->		
						 <!-- BEGIN switch_user_logged_out -->
						 <span class="gensmall">{LOGIN_TO_VOTE}<span><br />
						 <!-- END switch_user_logged_out -->
		  			</td>
				</tr>
			</table>{S_HIDDEN_FIELDS}</form>
		</td>
	</tr>
</table>
Den nachfolgenden Code speichern -> portal_poll_result.tpl und in den Ordner templates/dein_template/ hochladen

Code: Alles auswählen

<table width="100%" border="0" cellpadding="1" cellspacing="1" class="forumline">
	<tr>
		<th>{L_POLL}</th>
	</tr>
	<tr> 
		<td class="row2" colspan="2" align="center"> 
			<table width="100%" cellspacing="0" cellpadding="4" border="0" align="center">
				<tr> 
					<td class="row2" colspan="3" align="center"><span class="genmed"><b>{POLL_QUESTION}</b></span></td>
				</tr>
				<!-- BEGIN poll_option -->
				<tr> 
			  		<td width="100%" class="row2" valign="top"><span class="gensmall">{poll_option.POLL_OPTION_CAPTION}</span></td>
			  		<td width="60" class="row2" align="right" valign="top"><span class="gensmall">[ {poll_option.POLL_OPTION_RESULT} ]</span>&nbsp;</td>
				</tr>
				<tr> 
			  		<td width="100%" valign="top" class="row2"><img src="templates/subSilver/images/vote_lcap.gif" width="4" alt="" height="12" /><img src="{poll_option.POLL_OPTION_IMG}" width="{poll_option.POLL_OPTION_IMG_WIDTH}" height="12" alt="{poll_option.POLL_OPTION_PERCENT}" /><img src="templates/subSilver/images/vote_rcap.gif" width="4" alt="" height="12" /></td>
			  		<td valign="top" class="row2" align="center" width="60"><b><span class="gensmall">&nbsp;{poll_option.POLL_OPTION_PERCENT}&nbsp;</span></b>&nbsp;</td>
				</tr>
				<!-- END poll_option -->
    <tr> 
      	<td colspan="2" height="30" align="center" class="row2"><span class="gensmall"><b>{VOTED_SHOW}{voted_vote}<br />{L_TOTAL_VOTES}{TOTAL_VOTES}</b></span></td> 
    </tr> 
    <tr> 
    	<td colspan="2" align="center" class="row2"><span class="gensmall">{L_RESULTS_AFTER}</span></td> 
    </tr> 
    <tr> 
    	<td colspan="2" align="center" class="row2"><span class="gensmall">{L_POLL_EXPIRES}{POLL_EXPIRES}</span></td> 
    </tr>
    <tr> 
    	<td colspan="2" height="35" class="row2" align="center"><span class="gensmall"><a href="{U_VIEW_RESULTS}" class="gensmall"><b>{L_VIEW_RESULTS}</b></a></span></td> 
    </tr>

		  	</table>
		</td>
	</tr>
</table>
Das sollte es eigentlich gewesen sein :-)

Viel Spass damit

Markus

Verfasst: 06.02.2007 09:49
von Volker
hallo,

kannste das auch noch für das ezPortal basteln?

Verfasst: 03.03.2007 13:14
von cool_Torsten
Hi Markus67, super Arbeit, paar kleine Schönheitsfehler was das Layout betrifft, hier die Codeänderungen:

ÖFFNE portal_poll_ballot.tpl

FINDE:

Code: Alles auswählen

   <tr> 
      <th>{L_POLL}</th> 
   </tr>
ERSETZE MIT:

Code: Alles auswählen

  <tr>
        <td class="catHead" colspan="2" height="25"><span class="cattitle"><center><b>{IntroPortaltext18}:</b></center></span></td>
  </tr>
  <tr>
        <td colspan="2" height="1" class="row3"><img src="images/spacer.gif" width="1" height="1" alt="."></td>
  </tr>
FINDE:

Code: Alles auswählen

   </tr> 
</table>
Danach einfügen:

Code: Alles auswählen

<br>

ÖFFNE portal_poll_result.tpl

FINDE:

Code: Alles auswählen

   <tr> 
      <th>{L_POLL}</th> 
   </tr>
ERSETZE MIT:

Code: Alles auswählen

  <tr>
        <td class="catHead" colspan="2" height="25"><span class="cattitle"><center><b>{IntroPortaltext18}:</b></center></span></td>
  </tr>
  <tr>
        <td colspan="2" height="1" class="row3"><img src="images/spacer.gif" width="1" height="1" alt="."></td>
  </tr>
FINDE:

Code: Alles auswählen

   </tr> 
</table>
Danach einfügen:

Code: Alles auswählen

<br>

MfG cool_Torsten

Verfasst: 10.04.2008 15:45
von powersilie
Danke Markus und Thorsten!

Hab nach einer Lösung gesucht und hier die perfekte gefunden, klappt!
(ist zwar schon ein Jahr alt, aber super!)

Hab nur eine Frage:
Im Portal erscheinen zwar die Auswahlmöglichkeiten und man kann sie anklicken, aber kein Submit-Buton. (wenn man nicht eingeloggt ist)

Wenn man eingeloggt ist, erscheint das Ergebnis bzw. Zwischenergebnis und die Dauer der Umfrage. Und drunter "Ergebnis anzeigen" - obwohl es ja eh schon dasteht....

Hab ich da was falsch gemacht?

lg
Powersilie

Verfasst: 05.12.2008 09:26
von MadiMac
Hi
ich suche für meine ezportal stad eine mehrer polls anzeigen. ist das dafür gedacht ?

MFG