[3.2][3.3][BETA] Advanced Polls

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
warmweer
Jr. Extension Validator
Posts: 11645
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium

Re: [3.2][3.3][BETA] Advanced Polls

Post by warmweer »

ponchi101 wrote: Wed Jul 03, 2024 5:26 pm
I know, that is the reason I think there is something wrong I am doing. But I have searched all permissions and I can't find anything related to POLLS.
The default permission: can create polls / can vote in polls / can change vote (or something similar) would be in user/group-forum permissions

Use the permission mask: forum based permissions (you can then select user or group and forum) to see how the final permission is reached.

Note: I don't know the Advanced Polls extension so perhaps it includes an extra permission (which you'll probably recognise).
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
jasolo
Registered User
Posts: 132
Joined: Sat Jan 20, 2018 9:17 pm

Re: [3.2][3.3][BETA] Advanced Polls

Post by jasolo »

ponchi101 wrote: Wed Jul 03, 2024 2:08 pm Any ideas? Or do I have to activate that permission for them?
ACP -> PERMISSIONS -> Forum permissions -> (select one or more forums) -> (select users o groups) -> Edit permissions -> Advanced Permissions -> Polls -> Can Create Poll.

Image
ponchi101
Registered User
Posts: 43
Joined: Fri Dec 04, 2020 3:12 pm

Re: [3.2][3.3][BETA] Advanced Polls

Post by ponchi101 »

Txs guys.
I should have been able to figure that one out. :thumbsup:
deninho32
Registered User
Posts: 238
Joined: Tue May 21, 2019 8:57 am

Re: [3.2][3.3][BETA] Advanced Polls

Post by deninho32 »

Hervé wrote: Tue Oct 13, 2020 9:56 am I think other members are also interested in existing polls
to see which polls have been opened before creating one
to sea a summary of polls results
to encourage them to participate

I've made a separate page accessible via a button in the Navbar : https://www.leforumrecifal.com/AllPolls.php
title translation : All polls from Reef Forum the most recent first in descending order of voted options
layout should be improved.
Can you share how you did this? Is it automatically rendered?
phpBB 3.3.7 | PHP Version 7.4.33 | Milk Theme
Hervé
Registered User
Posts: 562
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: [3.2][3.3][BETA] Advanced Polls

Post by Hervé »

What do you mean by "automatically rendered" ?
deninho32
Registered User
Posts: 238
Joined: Tue May 21, 2019 8:57 am

Re: [3.2][3.3][BETA] Advanced Polls

Post by deninho32 »

Is it just a static page that you've made manually of are polls automatically added to the page with voters and statistics?
phpBB 3.3.7 | PHP Version 7.4.33 | Milk Theme
Hervé
Registered User
Posts: 562
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: [3.2][3.3][BETA] Advanced Polls

Post by Hervé »

It's automatically filled thanks to sql queries.
deninho32
Registered User
Posts: 238
Joined: Tue May 21, 2019 8:57 am

Re: [3.2][3.3][BETA] Advanced Polls

Post by deninho32 »

That's really nice. Can you tell me how to do that?
phpBB 3.3.7 | PHP Version 7.4.33 | Milk Theme
Hervé
Registered User
Posts: 562
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: [3.2][3.3][BETA] Advanced Polls

Post by Hervé »

Do you understand SQL ? PHP ?
deninho32
Registered User
Posts: 238
Joined: Tue May 21, 2019 8:57 am

Re: [3.2][3.3][BETA] Advanced Polls

Post by deninho32 »

Not very good at it, but I can always try it :D
phpBB 3.3.7 | PHP Version 7.4.33 | Milk Theme
Hervé
Registered User
Posts: 562
Joined: Tue Jun 04, 2019 7:51 am
Location: Belgium
Name: Rudy

Re: [3.2][3.3][BETA] Advanced Polls

Post by Hervé »

CSS

Code: Select all

:root
{
	--MainDivBkgnd: #ffffff;
	--SubTabBorder: #006699;
	--SubTabBkgnd:  #dbe7ef;
	--MainTdBorder:  #87CEEB;	/* royal blue */
	--SubTdBorder:  #87CEEB;	/* royal blue */
}

body {color: #000080; }
a {color: #0000FF; text-decoration: none;}
a:hover { background-color: aqua;}

div.fixed { position: fixed;  top: 20; left: 20;} /* UP & Home */
table {border-collapse: collapse; margin-left: auto; margin-right: auto;}

caption {color:var(--SubTabBkgnd); background-color: var(--SubTabBorder); 
	line-height: 1em;
	padding-top: 2px;
	padding-bottom: 2px;
	font-size: 0.8em;
	font-family: Arial, Helvetica, sans-serif;
	text-transform: uppercase;}

td.Sub1 { border: 1px solid var(--SubTdBorder); vertical-align: middle;}	
td.Sub2 { border: 1px solid var(--SubTdBorder); vertical-align: middle;}	

td.sub1 img { width: 160px; vertical-align:middle;}	/* img inside td */

div.main { width: 1220px; margin: 0 auto; background-color:var(--MainDivBkgnd); border-style:none;}

.Banniere {width: 1200px; display: block; padding-top: 10px; padding-bottom: 10px; margin: 0 auto; }

table.main {width: 1200px;}

tr.main {vertical-align: top;}

tr.sub:nth-child(odd) {background-color: #ECF3F7;}
tr.sub:nth-child(even) {background-color: #E1EBF2;}

table.sub {border: 5px solid var(--SubTabBorder); background-color: var(--SubTabBkgnd); width: 380px;}
table.last {border: 1px solid var(--SubTabBorder); background-color: var(--SubTabBkgnd); width: 380px;}

/* Nouvelles règles si la fenêtre fait au plus 1200px de large */
@media screen and (max-width: 1200px)
{
	div.main { width: 100vw;} 
	table.main {width: 97vw;} 
	table.sub {width: 27vw;} 
	table.last {width: 27vw;} 
	td.sub1 img { width: 14vw; }	/* img inside td */
}
PHP

Code: Select all

<TABLE class="main" frame="box" rules="rows"><caption>Tous les sondages le plus récent en premier par ordre décroissant de votes exprimés</caption>		<THEAD><TR><TH>Titre</TH><TH colspan=2>Votes</TH><TH>Option</TH><TH>Votants</TH></TR></THEAD>
<TBODY>
<?php
$RowBkgndEven="#ecf3f6";		
$RowBkgndOdd="#e1ebf1";
$RowBkgnd="";
// connexion à la base
$db = mysqli_connect("localhost","my_user","my_password")  or die('Erreur de connexion '.mysqli_error());
// sélection de la base  
   mysqli_select_db($db,your DB name)  or die('Erreur de selection '.mysqli_error());
$results = mysqli_query($db,'select * from phpbb_topics WHERE poll_title != "" ORDER BY topic_status ASC, topic_id DESC ');
while($result = mysqli_fetch_array($results))
	{ 
	$RowBkgnd = ($RowBkgnd == $RowBkgndEven ? $RowBkgndOdd : $RowBkgndEven);	/* condition ? true : false */
	$topic = $result['topic_id'];
	$options = mysqli_query($db,'select * from phpbb_poll_options WHERE topic_id = '.$topic.' AND poll_option_total != 0 ORDER BY poll_option_total DESC');
	$NumRows = mysqli_num_rows($options);
	$TotalVotes=0;
	while($option = mysqli_fetch_array($options)) $TotalVotes=$TotalVotes+$option['poll_option_total'];
	if ($TotalVotes == 0)
		{ 
		echo "<TR style='background-color:".$RowBkgnd."'><td>";
		echo "<a href='Your board url/viewtopic.php?f=".$result['forum_id']."&t=".$result['topic_id']."'>".$result['poll_title']."</a>";
		echo $result['topic_status'] == 1 ? "<br><img src='/images/Lock.gif'>" : "<br>";	/* condition ? true : false */
		echo "<br>".$TotalVotes." votes ";
		echo "</TD><td></td><td></td><td></td><td></td><td></td>";
		}  
	else
		{ 
		echo "<TR style='background-color:".$RowBkgnd."'><td rowspan=".$NumRows.">";
		echo "<a href='Your board url/viewtopic.php?f=".$result['forum_id']."&t=".$result['topic_id']."'>".$result['poll_title']."</a>";
		echo $result['topic_status'] == 1 ? "<br><img src='/images/Lock.gif'>" : "<br>";	/* condition ? true : false */
		echo "<br>".$TotalVotes." votes ";
		echo "</TD>";
		mysqli_data_seek($options, 0);	/* Reset query pointer */

		while($option = mysqli_fetch_array($options))
			{ 
			$Text = str_replace ("<s>","",$option['poll_option_text']);
			$Text = str_replace ("</s>","",$Text);

			$Percent=$option['poll_option_total']/$TotalVotes;
			echo "<td nowrap><img src='PollBar.jpg' height=16 width='".Round(100*$Percent)."'> ".$option['poll_option_total']."</TD>";
			echo "<td nowrap align = right> ".number_format(100*$Percent)."% : </TD>";
	
			echo !strpos($Text,":") ? "<td>".$Text : "<td>".substr($Text,0,strpos($Text,":"))."<small>".substr($Text,strpos($Text,":")-strlen($Text))."</small>";

			echo "</td><td><small>";
			$Sep="";
			$optionID = $option['poll_option_id'];
			$votes = mysqli_query($db, 'select vote_user_id from phpbb_poll_votes WHERE topic_id = '.$topic.' AND poll_option_id = '.$optionID);
			while($vote = mysqli_fetch_array($votes))
				{ 
				$users = mysqli_query($db, 'select username from phpbb_users WHERE user_id = '.$vote['vote_user_id']);
				while($user = mysqli_fetch_array($users))
					{ 
					echo $Sep.$user['username'];
					$Sep=", ";
					}  
				}  
			echo "</small></TD></TR><TR style='background-color:".$RowBkgnd."'>";
			} 
		}  
	echo "</TR>";
	}  
echo "</TBODY></TABLE>";
mysqli_close($db);
deninho32
Registered User
Posts: 238
Joined: Tue May 21, 2019 8:57 am

Re: [3.2][3.3][BETA] Advanced Polls

Post by deninho32 »

Thanks!

I'm going to try it this weekend!
phpBB 3.3.7 | PHP Version 7.4.33 | Milk Theme

Return to “Extensions in Development”