[外掛]票選結束後公佈結果

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

[外掛]票選結束後公佈結果

文章 動機不明 »

名稱: Hide poll results until poll is closed
來源: http://www.phpbbhacks.com/viewhack.php?id=1371
說明: 建立投票時若是有指定結束時間,則直到結束才會將投票結果顯示出來!
##########################################################################################
## Hack Title: Hide poll results until poll is closed | Show end of vote
## Hack Version: 1.0.2 (phpBB 2.0.4 or lower)
## Author: Acid
## "Show end of vote" by Sven Schumacher (modified)
## Support: http://www.phpbbhacks.com/forums/
##
## 說明: This hack hides the poll results until the poll is
## closed/expired and adds the ending time to any vote.
##
## 修改檔案數: 4
## viewtopic.php
## language/lang_english/lang_main.php
## templates/xxx/viewtopic_poll_result.tpl
## templates/xxx/viewtopic_poll_ballot.tpl
## 增加檔案數: 1
## templates/xxx/viewtopic_poll_notyet.tpl
##
##########################################################################################
##
## 備註:
## First always make a backup from the files that you're going to edit.
##
##########################################################################################
##
## Revision History:
##
## v1.0.2
## - results link modified
## v1.0.1
## - fixed a typo
## - if no ending time is set results will be shown now
## v1.0.0
## - Initial Release
##
##########################################################################################

複製 viewtopic_poll_notyet.tpl 到你的風格目錄底下 (例: /subSilver)
/templates/xxx/viewtopic_poll_notyet.tpl

開啟 viewtopic.php

尋找\r

代碼: 選擇全部

		if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED )
		{
			$template->set_filenames(array(
				'pollbox' => 'viewtopic_poll_result.tpl')\r
			);
取代為\r

代碼: 選擇全部

		if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED )
		{
                        if ( $vote_info[0]['vote_length'] != 0 && !$poll_expired )
                        {
                                if ( $user_voted && !$poll_expired || !$user_voted )
                                {
                			$template->set_filenames(array(
	                			'pollbox' => 'viewtopic_poll_notyet.tpl')
		                	);
                                }
                                else
                                {
		                	$template->set_filenames(array(
			                	'pollbox' => 'viewtopic_poll_result.tpl')
                			);
                                }
                        }
                        else
                        {
			$template->set_filenames(array(
				'pollbox' => 'viewtopic_poll_result.tpl')
			);
                        }
尋找\r

代碼: 選擇全部

				'L_VIEW_RESULTS' => $lang['View_results'],
取代為\r

代碼: 選擇全部

				'L_VIEW_RESULTS' => ( $vote_info[0]['vote_length'] != 0 && !$poll_expired ) ? '' : $lang['View_results'],
尋找\r

代碼: 選擇全部

		if ( count($orig_word) )
		{
			$vote_title = preg_replace($orig_word, $replacement_word, $vote_title);
		}
後面加入\r

代碼: 選擇全部

		if ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] > time() )
		{
		        $vote_end = $lang['Vote_until'] ." ". create_date($board_config['default_dateformat'], ($vote_info[0]['vote_start'] + $vote_info[0]['vote_length']), $board_config['board_timezone']);
		} 
		else if ( $vote_info[0]['vote_length'] == 0 )
		{
		        $vote_end = $lang['Vote_endless'];
		} 
		else
		{
		        $vote_end = $lang['Vote_closed'];
		}
尋找\r

代碼: 選擇全部

		$template->assign_vars(array(
			'POLL_QUESTION' => $vote_title,
後面加入\r

代碼: 選擇全部

			'VOTE_HIDE' => $lang['Vote_hide'],
			'VOTE_END' => $vote_end,
開啟 /templates/xxx/viewtopic_poll_ballot.tpl

尋找\r

代碼: 選擇全部

<td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span> 
在該行的最後面加入\r

代碼: 選擇全部

<br /><span class="gensmall">({VOTE_END})</span>
開啟 /templates/xxx/viewtopic_poll_result.tpl

尋找\r

代碼: 選擇全部

<td align="center"><span class="gen"><b>{POLL_QUESTION}</b></span>
在該行的最後面加入\r

代碼: 選擇全部

<br /><span class="gensmall">({VOTE_END})</span>


開啟 /language/lang_chinese_traditional_taiwan/lang_main.php

尋找\r

代碼: 選擇全部

$lang['Delete_poll'] = '刪除票選活動';
後面加入\r

代碼: 選擇全部

$lang['Delete_poll'] = '刪除票選活動';
$lang['Vote_hide'] = '必須等到投票結束後才能夠看到結果.'; 
$lang['Vote_until'] ="票選期限至:"; 
$lang['Vote_endless'] ="沒有設定結束時間."; 
$lang['Vote_closed'] ="票選已關閉!";
儲存所有檔案,完工! ;-)

TEST & DEMO : http://gop.pda.com.tw/viewtopic.php?t=3847
主題已鎖定

回到「非官方認證外掛」