1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

On old polls, display right poll with the comments

This commit is contained in:
e107steved 2008-06-03 21:31:31 +00:00
parent 72f1bbd319
commit 996d0322f3
3 changed files with 44 additions and 24 deletions

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/comment.php,v $
| $Revision: 1.5 $
| $Date: 2008-05-25 08:26:11 $
| $Revision: 1.6 $
| $Date: 2008-06-03 21:31:31 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -288,6 +288,7 @@ else
$comments_poll = $row['poll_comment'];
$subject = $row['poll_title'];
define("e_PAGETITLE", COMLAN_101." / ".COMLAN_99." / ".$subject."");
$poll_to_show = $id; // Need to pass poll number through to display routine
require_once(HEADERF);
require(e_PLUGIN."poll/poll_menu.php");
$field = $row['poll_id'];
@ -296,7 +297,6 @@ else
require_once(FOOTERF);
exit;
}
require_once(HEADERF);
}
break;
case 'download' :

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_class.php,v $
| $Revision: 1.7 $
| $Date: 2007-11-01 22:47:25 $
| $Revision: 1.8 $
| $Date: 2008-06-03 21:31:31 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -233,11 +233,19 @@ class poll
function render_poll($pollArray = "", $type = "menu", $POLLMODE = "", $returnMethod=FALSE)
{
global $POLLSTYLE, $sql, $tp, $ns;
if($POLLMODE == "query")
switch ($POLLMODE)
{
case "query" : // Show poll, register any vote
$this->get_poll($pollArray);
$pollArray = $this->pollRow;
$POLLMODE = $this->pollmode;
break;
case 'results' :
if ($sql->db_Select_gen($pollArray))
{
$pollArray = $sql -> db_Fetch();
}
break;
}
$barl = (file_exists(THEME."images/barl.png") ? THEME_ABS."images/barl.png" : e_PLUGIN."poll/images/barl.png");
@ -272,7 +280,7 @@ class poll
// $voteArray = array_slice($voteArray, 0, -1);
}
else
{
{ // Get existing results
$optionArray = explode(chr(1), $pollArray['poll_options']);
$optionArray = array_slice($optionArray, 0, -1);
$voteArray = explode(chr(1), $pollArray['poll_votes']);
@ -313,7 +321,8 @@ class poll
{
$POLLMODE = "notvoted";
}
else if($type == "forum") {
elseif($type == "forum")
{
$preview = TRUE;
}
@ -331,14 +340,18 @@ class poll
$text = "<form method='post' action='".e_SELF.(e_QUERY ? "?".e_QUERY : "")."'>\n".preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_NOTVOTED_START : $POLL_NOTVOTED_START));
$count = 1;
$alt = 0; // alternate style.
foreach($optionArray as $option) {
foreach($optionArray as $option)
{
// $MODE = ($mode) ? $mode : ""; /* debug */
$OPTIONBUTTON = ($pollArray['poll_allow_multiple'] ? "<input type='checkbox' name='votea[]' value='$count' />" : "<input type='radio' name='votea' value='$count' />");
$OPTION = $tp->toHTML($option, TRUE);
if(isset($POLL_NOTVOTED_LOOP_ALT) && $POLL_NOTVOTED_LOOP_ALT && $type != "forum"){ // alternating style
if(isset($POLL_NOTVOTED_LOOP_ALT) && $POLL_NOTVOTED_LOOP_ALT && $type != "forum")
{ // alternating style
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($alt == 0 ? $POLL_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP_ALT));
$alt = ($alt ==0) ? 1 : 0;
}else{
}
else
{
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_NOTVOTED_LOOP : $POLL_NOTVOTED_LOOP));
}
$count ++;
@ -353,24 +366,19 @@ class poll
break;
case "voted":
case 'results' :
if($pollArray['poll_result_type'] && !strstr(e_SELF, "comment.php"))
{
$text = "<div style='text-align: center;'><br /><br />".POLLAN_39."<br /><br /><a href='".e_BASE."comment.php?comment.poll.".$pollArray['poll_id']."'>".POLLAN_40."</a></div><br /><br />";
}
else
{
$text = preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_VOTED_START : $POLL_VOTED_START));
$count = 0;
foreach($optionArray as $option)
{
$OPTION = $tp->toHTML($option, TRUE);
$BAR = ($percentage[$count] ? "<div style='width: 100%'><div style='background-image: url($barl); width: 5px; height: 14px; float: left;'></div><div style='background-image: url($bar); width: ".(floor($percentage[$count]) != 100 ? floor($percentage[$count]) : 90)."%; height: 14px; float: left;'></div><div style='background-image: url($barr); width: 5px; height: 14px; float: left;'></div></div>" : "");
$PERCENTAGE = $percentage[$count]."%";
$VOTES = POLLAN_31.": ".$voteArray[$count];
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_VOTED_LOOP : $POLL_VOTED_LOOP));
@ -378,7 +386,6 @@ class poll
}
}
$text .= preg_replace("/\{(.*?)\}/e", '$\1', ($type == "forum" ? $POLL_FORUM_VOTED_END : $POLL_VOTED_END));
break;
case "disallowed":
@ -394,7 +401,7 @@ class poll
{
$DISALLOWMESSAGE = POLLAN_41;
}
else if($pollArray['poll_vote_userclass'] == 254)
elseif($pollArray['poll_vote_userclass'] == 254)
{
$DISALLOWMESSAGE = POLLAN_42;
}

View File

@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/poll/poll_menu.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:35:40 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-06-03 21:31:31 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@ -41,12 +41,25 @@ if(!defined("POLL_1"))
@include_once(e_PLUGIN."poll/languages/English.php");
}
if (empty($poll_to_show))
{
$poll_to_show = ' AND p.`poll_vote_userclass`!=255';
$pollType = 'menu';
$pollMode = 'query';
}
else
{
$poll_to_show = ' AND p.`poll_id`='.$poll_to_show;
$pollType = 'menu';
$pollMode = 'results';
}
$query = "SELECT p.*, u.user_name FROM #polls AS p
LEFT JOIN #user AS u ON p.poll_admin_id = u.user_id
WHERE p.poll_vote_userclass!=255 AND p.poll_type=1
WHERE p.poll_type=1{$poll_to_show}
ORDER BY p.poll_datestamp DESC LIMIT 0,1
";
$poll->render_poll($query, "menu", "query");
$poll->render_poll($query, $pollType, $pollMode);
?>