Poll Block

Poll Block

by Paul Holden -
Number of replies: 92
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
I've added another new block to the Modules & Plugins database: Poll Block.

It allows you to create and customize polls for use in a Moodle course, and view detailed response information for them.

Poll block result

Paul smile

P.S. I've just submitted the block to the database, so it may take some time before it is approved by one of the admins and available to download.
Average of ratings: Useful (2)
In reply to Paul Holden

Re: Poll Block

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I created something like this a while back - called the "choice block" - I must admit I haven't had a chance to look at it again for a while. - Moodle already has "poll" or "choice" features, and the block leverages the existing Choice framework, and allows you to get a similar display to the one you have above!

I would also welcome any ideas/help to improve the choice module, and the choice block - it has been on my list of things to improve for a while!

smile

Dan

In reply to Paul Holden

Re: Poll Block

by Monico Briseño -
Picture of Testers
Greetings from México. Paul, thank you for this great block. I've installed it on Moodle 1.8.2 and it works fine!


Cheers
Mónico

Attachment pollblock.jpg
In reply to Monico Briseño

Re: Poll Block

by Andy Brookes -
does anyone know if this block allows guests to vote as well, for instance if it was placed on the front page? or do you need to be logged in to vote? cheers
In reply to Andy Brookes

Re: Poll Block

by Ahmed Metwally -

Hi

After installation for 1.8.2, once i added the block to a course i got the following erorrs:

Warning: Invalid argument supplied for foreach() in /var/www/html/elegmoodle/blocks/poll/block_poll.php on line 62

Warning: uasort(): The argument should be an array in /var/www/html/elegmoodle/blocks/poll/lib.php on line 11

Warning: Invalid argument supplied for foreach() in /var/www/html/elegmoodle/blocks/poll/block_poll.php on line 71

Any suggestions I really need it.

Thank you in advance,

In reply to Ahmed Metwally

Re: Poll Block

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Ahmed,

Did the errors occur after you've created a poll or after adding the block? If after creating the poll, you need to make sure you add some options to the poll.

Paul
In reply to Andy Brookes

Re: Poll Block

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Andy,

Currently you need to be logged in to vote on a poll. Allowing guests to vote is a good idea, I'll look into it!

Paul
In reply to Paul Holden

Re: Poll Block

by Leang Chumsoben -
Hello Paul,

Is there any progress on this new idea? Just like Andy, I would also like to have this block appear on the front page and all the site visitors can vote on it.

Thank you for this great block.

Soben
In reply to Paul Holden

Re: Poll Block

by Cesar Romo -

hi Paul,

  As per Andy's comment, I have implemented the poll block in the front page. If a submit the vote as a guest, all the subsequent accesses to the site (front page) graph with the results is displayed without the option for voting. Therefore, visitor should have to log in first if he/she wants to vote. When do you plan to implement the change for guest voting? Another suggestion is to add (beside the number of responses per bar), the corresponding pct % from the total of votes.

After all these, your block would be near to the perfection! Please consider these comments

In reply to Cesar Romo

Re: Poll Block

by Pablo Cecere -
I made some changes to this block. I just installed it in 1.9.2 and works fine.
I added percentage info.
I changed the color of the bars, so the one (or ones) with more votes is shown in red, and the rest in yellow.
I keep original order, instead of reordering from most voted to less voted.

If you want this version, let me know.

Attachment poll.JPG
In reply to Pablo Cecere

Re: Poll Block

by Luis Perez -
Will like to receive a copy of your block - I use this block in my courses.

Luis Perez
In reply to Pablo Cecere

Re: Poll Block

by mike sebolt -
I would love to have a version of this that runs in 1.9.3
In reply to mike sebolt

Re: Poll Block

by Pablo Cecere -
I am running 1.9.2 (Build: 20080711)
The standard poll block doesnt work in 1.9.3???
Let me know, and I will make it work!

In reply to Pablo Cecere

Re: Poll Block

by Judy Perry -
I would also like a copy of this.

Unfortunately, I'm Moodle-admin stupid (had to jump right on in though because my sysadmin refuses to support it any longer).

So, here goes...

Judy
In reply to Pablo Cecere

Re: Poll Block

by John Foley -
Hi Pablo,

I would love to get a version of your Poll Block. Is it available to download?

Thanks

John
In reply to Pablo Cecere

Re: Poll Block

by Gavin Stokes -
Hi Pablo,
I would really like to try your poll block.
Where can I get this from?

Many thanks smile
In reply to Pablo Cecere

Re: Poll Block

by satish agrawal -

Hi Pablo,

Can we change the color of each bar?

Please help me in case you have any idea abt it......

In reply to Pablo Cecere

Re: Poll Block

by Paullo Abreu -

Hello there, Pablo. How did you change the colors and added the percentages?

In reply to Cesar Romo

Re: Poll Block

by Cesar Romo -

Hi,
For those who might be interested, I've found an easy way to modify the poll block in oder get the results that I was looking for...

After standard poll block has been installed successfully:

(a) Edit block_poll.php as follow:

Change:

function poll_get_results(&$results, $sort = true) {

foreach ($this->options as $option) {

$responses = get_records('block_poll_response', 'optionid', $option->id);

$results[$option->optiontext] = (!$responses ? '0' : count($responses));

}

if ($sort) { poll_sort_results($results); }

}

With:

function poll_get_results(&$results, $sort = true) {

$totalvotes = 0;

foreach ($this->options as $option) {

$responses = get_records('block_poll_response', 'optionid', $option->id);

$totalvotes = $totalvotes + (!$responses ? '0' : count($responses));

}

foreach ($this->options as $option) {

$responses = get_records('block_poll_response', 'optionid', $option->id);

$results[$option->optiontext] = (!$responses ? '0' : round(count($responses)/$totalvotes*100,0))."%";

}

if ($sort) { poll_sort_results($results); }

}

Change:

$func = 'poll_print_' . (!$response && $this->poll_user_eligible() ? 'options' : 'results');

With:

session_start();

if(isset($_SESSION['re-submit_poll'])) {

$func = 'poll_print_results';

} else {

$func = 'poll_print_options';

}

(b) Edit poll_action.php as follow:

Change:

case 'respond':

if (!get_record('block_poll_response', 'pollid', $pid, 'userid', $USER->id)) {

$response = new Object();

$response->id = 0;

$response->pollid = $pid;

$response->optionid = required_param('rid', PARAM_INTEGER);

$response->userid = $USER->id;

$response->submitted = time();

insert_record('block_poll_response', $response);

}

With:

case 'respond':

$response = new Object();

$response->id = 0;

$response->pollid = $pid;

$response->optionid = required_param('rid', PARAM_INTEGER);

$response->userid = $USER->id;

$response->submitted = time();

insert_record('block_poll_response', $response);

session_start();

$_SESSION['re-submit_poll'] = 1;

Users (guests or already authentificated) would be able to vote multiple times, as soon as their current sessions are terminated/closed and they start a new one.

Hope it helps for you.

-Cesar R 

In reply to Paul Holden

Re: Poll Block

by Edward Roche -
This Block looks good but this is the first time I am going to install new block so my question is what is the proper process? I extract the poll folder into the blocks directory but it then doesn't show up as an option. What am I doing wrong?

Any help would be great!

Thanks
Ed
In reply to Paul Holden

Re: Poll Block

by Mandisa Jackson -
Hi all,

I'm on 1.8.2 and when I try to install, the notification screen gives me the below. Any idea why?? Thx in advance...

This script generated 3 warnings - Scroll to the first warning

poll


(mysql): CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) NOT NULL default 0, `questiontext` text NOT NULL default '', `eligible` enum('all', 'students', 'teachers') NOT NULL default 'all', `created` bigint(10) NOT NULL default 0, PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains polls for the poll block.'
1101: BLOB/TEXT column 'questiontext' can't have a default value
 
 
 

 


(mysql): CREATE TABLE mdl_block_poll_option ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optiontext` text NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains options for each poll in the poll block.'
1101: BLOB/TEXT column 'optiontext' can't have a default value
 
 
 

 


(mysql): CREATE TABLE mdl_block_poll_response ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optionid` int(11) NOT NULL default 0, `userid` int(11) NOT NULL default 0, `submitted` bigint(10) NOT NULL default 0, PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains response info for each poll in the poll block.'
1050: Table 'mdl_block_poll_response' already exists
 
 
 

 


Block poll tables could NOT be set up successfully!

In reply to Paul Holden

Re: Poll Block

by Attila Paksi -
I like this block, its a really good idea!
But - ufortunately - I have a problem with it:
After submitting, I can see the current result. But only the numbers are there, and a one pixel width "picture" (graph)... I show you:
szavazs.jpg

I dont know, what can be the problem?
Attachment szavazs.jpg
In reply to Attila Paksi

Re: Poll Block

by DoVisH DoVisH -

Under the Configure Poll label add some width to the Maximum graph width, perhaps 10.

In reply to DoVisH DoVisH

Re: Poll Block

by Sarah Quantick -
I have installed poll on 1.9 but get the following notices if I run debug.

Notice undefined variable: img in var/www/html/moodle/blocks/poll/block_poll.php on line 72

and

Notice undefined variable: highest in var/www/html/moodle/blocks/poll/block_poll.php on line 73

How can I resolve these

Thanks

Sarah
In reply to Sarah Quantick

Re: Poll Block

by Anil Sharma -
I have just installed it in 1.9 beta 3 , absolutely no problems and it works great. Thanks , Paul for the block - very very useful - should be a part of standard moodle
In reply to Attila Paksi

Re: Poll Block

by Tomas A. Ramirez Andujar -
Well, I set up the Poll, it installed apparently ok, I as an admin can see but not the users, teachers,, no one. ANy suggestions.
Cheers
In reply to Tomas A. Ramirez Andujar

Re: Poll Block

by shen yiching -
Yes,I have the same problem. As an administrator,I need to have a poll for all teachers that used moodle . I hope the teachers can see the poll block and response it when they login moodle before entering their courses.Thanks!
In reply to Paul Holden

Re: Poll Block

by John Hill -

Hi,

I've started using this Poll and it's a valuable edition but I would benefit if it could be presented within a page instead of a block running down the side e.g. if I could attach it as an activity. Has this been looked into? Is there anyway of achieving this?

Thanks
John

In reply to John Hill

Re: Poll Block

by Anil Sharma -
John

Moodle, by default, has a Poll activity called 'Choice' - maybe you could try that ?
In reply to Anil Sharma

Re: Poll Block

by John Hill -

Thanks Anil,

I'm new to Moodle and haven't tried using the 'Choice' activity yet, Instead I've gone striaght to using the poll facility but i'll take a step back and take a look at the 'Choice' activity and see if this can perform the job I need.

John

In reply to John Hill

Re: Poll Block

by Janet DiVincenzo -

Hi John,

I have this same question -- how to integrate the poll within a page, instead of on the side.  Did you get this to work?

Thanks!

Janet

In reply to Paul Holden

Re: Poll Block

by Anthony Montalvo -

Hi Paul,

I love your Poll Block, it's been a really useful addition to my courses. I have run across one detail that I can't seem to work out, probably due to my lack of technical expertise. It seems the font the poll options are displayed in is taken from the stylesheet corresponding to the course's main section content. My course templates use a smaller font for the sideblocks, which means the font used for the poll block is larger that the rest of my sideblocks.

I hope my explanation makes some sense!

What do I need to do to fix this?

Thanks a million,
Tony

In reply to Paul Holden

Re: Poll Block

by Jonathan Harker -
Attached is the install.xml file needed to get the poll block working in 1.9
HTH smile
In reply to Jonathan Harker

Re: Poll Block

by ChanHan Hy -
Hi,

Poll block is not working correctly with Moodle 1.9.2
How to get it work???

==================================
I had created a poll, but it doesn't show the options to vote at all. It just show result (0)

Please look at the picture:

Attachment poll.gif
In reply to ChanHan Hy

Re: Poll Block

by Paul Holden -
Picture of Core developers Picture of Moodle HQ Picture of Moodle Workplace team Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi,

When you create/edit a poll there is an option named "Eligible users" - try setting this to "All", that should allow any logged in user to vote.

Paul
In reply to Jonathan Harker

Re: Poll Block

by Zbysiu Rodak -
I'm currently running Moodle 1.9.1+ (Build: 20080611). I've put the install.xml file in the poll/db folder, uploaded it to the Blocks folder, run Notifications, green lights all the way. I can see it in Manage Blocks but it doesn't appear in the Add Activity dropdown. Your help would be appreciated.
In reply to Paul Holden

Changed layout problem Re: Poll Block

by David MacDermott -
Hi

I've had a bit of an oups!

I installed Poll set the width to 180 added and moved it to top of left side. But since then it has changed something in the page that has added white space or changed the width of something.

I've uninstalled it but the problem still appears.

Attached are screenshow showing the live site with the changes and from the test site (how live site looked before this). You can see in the top image the login name top right has moved and the boots have also moved.

http://www.virtualgms.org/moodle/
http://www.virtualgms.org/test-moodle/

CSS etc all excactly the same. Any ideas what would have changed to cause this problem.

my problem - click for larger
In reply to David MacDermott

Re: Changed layout problem Re: Poll Block

by David MacDermott -
Hang on it's got nothing to do with Polls it was Active users block that was doing it. I also updated it but didn't even activate it. strange! Anyway stress over.
In reply to Paul Holden

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Paul Holden

Re: Poll Block

by keoshi lipsum -
How I can add more poll blocks at the same course?
In reply to keoshi lipsum

Re: Poll Block

by Leo Dano -
I get this error when trying to create a poll


In reply to Leo Dano

Re: Poll Block

by Shail Jai -

hi, Leo

i also got this error, if u have solution then please post me..

thnx

shail

In reply to Leo Dano

Re: Poll Block

by Shail Jai -

hi Leo ,

thnx for quick reply i got this error when i use poll block .

thnx

In reply to Paul Holden

Re: Poll Block

by Joseph Vargas -

My company does live webcasts for corporate and medical education.

We stream video encoded using windows mediaplayer in an interface that has a window for video and an area for PowerPoint Slides.

I would like to use Moodle to register attendees, create reports, provide the viewer the link to activate the live webcast, do quizing, chat and forums.

So from the viewers perspective... the LMS would be in one browser window while the streaming media presentation would open in a different window.

The challange is that our clients want to include polling questions intermixed with the powerpoint slides.  They also want a record of how each participant answered the polling questions. This is easy at a live meeting because of applications like TurningPoint's ARS system.

I am looking for a way to do this using Moodle and your block.

Here are the problems as I see them:

1 - The polling question needs to appear when the presenter pushes it to the viewer.
2 - The results need to appear when the present triggers them to be displayed
3 - The Question needs to either disappear or advance to the next polling question under control of the presenter.
4 - As you may know.. there is a buffer of at least 20 seconds when doing a live webcast. So how can the polling questions appear, display the results and advance to the next polling question in the moodle window when the video in the streaming media window has a 20 second delay.

Windows mediaplayer has the ability to include metadata in the stream that might be used to issue instructions to Moodle, but how to implement this is way above me.

Thanks for any help you can offer.

Joe

In reply to Paul Holden

Re: Poll Block

by Rishi VG -
Hello,
Today I download the poll zip file and i upload that into mod directory.

In broswer i tried to install.
I am getting error :
Module poll: /home/election/public_html/mod/poll/version.php was not readable


How to slove this issues. where this version.php in poll zip file.

Rishi


In reply to Rishi VG

Re: Poll Block

by John Foley -
Rishi,

This is a block, not a module. You should install it in the blocks directory.

Regards,

John
In reply to Paul Holden

Re: Poll Block

by Daran Price -
Hi,
thanks for the poll block it is great tool! We would like to be able to place a poll in the "my" page for all users as a sticky block, however when submiting a vote the block seems to take the user id as the course id and tries to open what it thinks is the required page? It all works fine if placed in a course page and only creates this error on the "my" page.
Is there anyway around this issue as it would be great to use it as a site wide sticky block as well as a tool for tutors within the course or unit pages?

Kindest Regards Daran
In reply to Daran Price

Re: Poll Block

by Daran Price -
Having played around a bit more I managed to place this small hack in which appears to allow a sticky poll block on the "my" page.

In poll_action.php below the line

if ($cid == 0) $cid = 1;

add the following

if (! $course = get_record("course", "id", $cid)) {
$cid = 1;
}

Kindest Regards Daran
In reply to Daran Price

Re: Poll Block

by Cyndy Pederson -
Thanks for the fix!  It works great.
In reply to Cyndy Pederson

Re: Poll Block

by Daran Price -
Just a note to say the above hack does mean that admin users get sent back to the standard admin home page rather than the "my" page for tutors and students.

Kindest Regards Daran
In reply to Paul Holden

Re: Poll Block

by Mat Connolley -
Hi, I'm trying to install this block on Moodle 1.9 + (Build: 20080417). I've copied the poll folder into the blocks directory, but no joy - nothing appears in the notifications page. Any suggestions gratefully received!

Thanks,

Mat.
In reply to Mat Connolley

Re: Poll Block

by satish agrawal -

You also need to copy the install.xml in the db folder present inside poll folder.

I have attahced the file also.

In reply to satish agrawal

Re: Poll Block

by Mat Connolley -
Hi Satish,

Thanks, I've tried this but still no joy. I've been able to successfully install it on other Moodles that I have (1.9.4), just not this one. It's very odd!

Best wishes,

Mat.
In reply to satish agrawal

Re: Poll Block

by Claire Browne -
Hi Regarding this Poll,

I can successfully put the block on my moodle page, I go to create a poll and i click save then the data has gone?

it is not saving my poll?

what am i doing wrong?

i have placed the .xml file in the poll folder as well.

I am working on moodle 1.9.5

In reply to Paul Holden

Re: Poll Block

by John Rickard -
Hi All,

I am running Moodle 1.9.5 and I have just installed the Poll block, without an install.xml ?!?!

I did have to tweak the /db/mysql.sql for it to install correctly!

Line 5: `questiontext` text NOT NULL default ' ', change to `questiontext` text,#
similarly on Line 14 `optiontext` text NOT NULL default ' ', change to `optiontext` text,

When installing, it kept erroring saying the above values can not have a NOT NULL value of ' '

Installed fine after altering those lines - about to run some test polls...

Im not a Postgres man - so I am not sure if the block would fail on install for the same reason on this database...
In reply to Paul Holden

תשובה ל: Poll Block

by Miki Alliel -
Picture of Translators

Thanks for the block, but from some reason I'm getting this errors when trying to install the poll Block after clicking of "notifications" under admin block:

(mysql): CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) NOT NULL default 0, `questiontext` text NOT NULL default '', `eligible` enum('all', 'students', 'teachers') NOT NULL default 'all', `created` bigint(10) NOT NULL default 0, PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains polls for the poll block.'   1101: BLOB/TEXT column 'questiontext' can't have a default value

         ADOConnection._Execute(CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) ..., false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) ...) % line   89, file: dmllib.php
   execute_sql(CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) ...) % line  235, file: dmllib.php
modify_database(C:\inetpub\wwwroot\moodle195\moodle/blocks/poll/db/mysql.sql) % line 1376, file: blocklib.php
upgrade_blocks_plugins(
http://xxxxx/moodle195/moodle/admin/index.php) % line  452, file: index.php

ErrorScroll to next warning
(mysql): CREATE TABLE mdl_block_poll_option ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optiontext` text NOT NULL default '', PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains options for each poll in the poll block.'   1101: BLOB/TEXT column 'optiontext' can't have a default value

         ADOConnection._Execute(CREATE TABLE mdl_block_poll_option ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optiontext` tex..., false) % line  891, file: adodb.inc.php
      ADOConnection.Execute(CREATE TABLE mdl_block_poll_option ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optiontext` tex...) % line   89, file: dmllib.php
   execute_sql(CREATE TABLE mdl_block_poll_option ( `id` int(11) NOT NULL auto_increment, `pollid` int(11) NOT NULL default 0, `optiontext` tex...) % line  235, file: dmllib.php
modify_database(C:\inetpub\wwwroot\moodle195\moodle/blocks/poll/db/mysql.sql) % line 1376, file: blocklib.php
upgrade_blocks_plugins(
http://xxxxx/moodle195/moodle/admin/index.php) % line  452, file: index.php

Scroll to previous warningErrorScroll to continue button

I'm using IIS 5 and php 5.2, mysql 5.0.82

I tried it on moodle 1.9.3, 1.9.4 and 1,9,5  non of those worked, always same errors.

I hope there is a solution

Thanks

In reply to Miki Alliel

Re: תשובה ל: Poll Block

by Zbysiu Rodak -
Can I just add that I'm having the exact same problem, but running IIS7, php 5.2 anf mysql 5+ on moodle 1.9.5. sad
In reply to Miki Alliel

Re: תשובה ל: Poll Block

by Zbysiu Rodak -
I've tried this and now get the following error -

(mysql): CREATE TABLE mdl_block_poll ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL default '', `courseid` int (11) NOT NULL default 0, `questiontext` text,# `eligible` enum('all', 'students', 'teachers') NOT NULL default 'all', `created` bigint(10) NOT NULL default 0, PRIMARY KEY (`id`)) TYPE=MyISAM COMMENT='Contains polls for the poll block.'
1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
 
 
 




Any solutions out there? Please.

In reply to Paul Holden

Re: Poll Block

by Leang Chumsoben -
Hello Paul,

Many thanks for this great block.

And it would be even greater if we can switch between the Radio button and the Checkbox. At the moment we can use this block for the single-answer question only.

For the multiple-answer question like the following, we can't create with this block.

Fullscreen%20capture%201082009%2014953%20PM.jpg

Looking forward to the new version of this block.

Greeting from Cambodia,
Soben
In reply to Leang Chumsoben

Re: Poll Block

by Claire Browne -
My polll does not work in MOODLE 1.9.5 STABLE i can create till my heart content but moodle will never save, so i cannot configure anything.
In reply to Claire Browne

Re: Poll Block

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear All,

I am experiencing the same issue as Claire with localhost installations of 1.9.5 (for work) and the latest 1.9.8 (for development).

Help!!

Cheers,

Gareth
In reply to Paul Holden

Re: Poll Block

by Alan Arnold -
Greetings from Canberra Paul. Let me add my thanks for this great block. We have been using it on our University's myMoodle page for regular "10 second surveys" of our user population.

We're hoping you'd be prepared to make a small modification - to add a configuration check box that makes the poll results optionally anonymous ie don't collect and display user ids and photos.

We're currently using 1.9.6 and planning to make the big move to 2.0 in 2011. Do you have plans to support the block for 2.0?
In reply to Paul Holden

Re: Poll Block

by mike sebolt -

we recently had to move our Moodle site to a new IIs box running mysql and PHP 5.2.8 The Moodle version is Moodle 1.9.5 (Build: 20090513) I can't get the poll block to install now. Any help wouyld be appreciated.

In reply to Paul Holden

Re: Poll Block

by Tina Schaefer -

Are there any plans to develop the poll block for Moodle 2.0?

In reply to Tina Schaefer

Re: Poll Block

by Travis Wilhelm -

I would definitely like a Moodle 2.0 version of this (and am happy to try to help convert if someone can get me started!).

I've had requests from students for the Poll to return since we upgraded to Moodle 2.0 - they love it! smile

In reply to Travis Wilhelm

Re: Poll Block

by Claire Browne -

Hello,

Yes I would be happy to help Test the Moodle 2.0 or even help out with ideas etc to get the ball rolling.

In reply to Travis Wilhelm

Re: Poll Block

by David Cousens -

The idea of a Moodle 2.x version of the poll block gets my vote too - we used it extensively with 1.9 and miss it.

In reply to Travis Wilhelm

Re: Poll Block

by Adam Olley -
Picture of Core developers Picture of Plugin developers

Hi All,

We've recently ported the poll block for moodle 2.
https://github.com/netspotau/moodle-block_poll (master branch)

I look forward to feedback / bug reports / etc. smile 

Average of ratings: Useful (3)
In reply to Adam Olley

Re: Poll Block

by Mark B -

Hi Adam,

I have recently been looking for such a plugin and have tried it on Moodle 2.2 and it does not appear to work.  I press update and it tells me that the plugin is out of date and cannot continue.  Here is the error i am receiving:

Plugin "block/block_poll" is defective or outdated, can not continue, sorry.

More information about this error

Debug info: Missing main block class file.
Stack trace:
  • line 635 of /lib/upgradelib.php: plugin_defective_exception thrown
  • line 273 of /lib/upgradelib.php: call to upgrade_plugins_blocks()
  • line 1466 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 317 of /cp/index.php: call to upgrade_noncore()

Many thanks,

Mark

In reply to Mark B

Re: Poll Block

by Adam Olley -
Picture of Core developers Picture of Plugin developers

Hi Mark,

It looks to me you've named the folder wrong after pulling it out of github.

You'll want the poll block to be in:

<moodleroot>/blocks/poll

not

<moodleroot>/blocks/block_poll

In reply to Adam Olley

Re: Poll Block

by Mark B -

Many thanks,

Got it working in 2.2 dude, cheers.

Mark

In reply to Adam Olley

Re: Poll Block

by Florian Wetzel -

Hi Adam,

I'm really glad about your work - we were really hoping that someone would create a poll block for moodle2 and now it's done! Just installed it in moodle 2.2.1 and it's working fine! Thanks a lot!smile

Is it possible to use an own language package? I've added a block_poll.php to this post, that I've translated into German.

In reply to Florian Wetzel

Re: Poll Block

by Adam Olley -
Picture of Core developers Picture of Plugin developers

Thanks Florian, I've added your translation under lang/de/ in the repo. So if you're set to use german as your language in Moodle, it should use your translation for the block smile

In reply to Adam Olley

Re: Poll Block

by Florian Wetzel -

Hey Adam,

there is a funny thing about that:

In German, there are two ways to speak to a person, so there are two lang-bundles in moodle:

  1. formal/polite/speaking to adults (lang-bundle: de)
  2. non-standard/speaking to children or to friends (lang-bundle: de_du)

The funny thing is, the setting "de_du" works fine, but not the setting "de" - it doesn't matter of you call the folder "de", "de_utf8", "de_du" or whatever I've tried...wink So, I'm working on it to make it useable in both settings.

In reply to Florian Wetzel

Re: Poll Block

by Florian Wetzel -

I can't edit or delete my last post any more - so I just want to say I solved my problem simply by temporally deactivating "langcache" and "langstringcache" in the language settings of the site administration. (I've added the language-package afterwards.)

To whom it may concern: I've now created/edited both packages (de, de_du) and compressed the new files into a zip-File, which is added to this post. (The first version could not display our "evil German letters" ä, ö, ü.wink)

In reply to Adam Olley

Re: Poll Block

by Travis Wilhelm -

Thanks for your work on the new version of this block. I have installed it, created a poll on the front page, but now get a PHP Coding error when I go to the responses page.  The responses are shown, then the error message. Details are below.

Note that I also can't get to the 'configure block' page - this seems to only redirect back to our homepage. Not sure exactly what is happening. I have also just done a little test inside a course, and I have successfully created a poll, and put my own response in and it all seems to be working fine - maybe it's something unique with a front page poll?

-------------------------

Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

More information about this error

Debug info: Argument 1 passed to core_renderer::user_picture() must be an instance of stdClass, boolean given, called in C:\xampp\htdocs\blocks\poll\tab_responses.php on line 74 and defined 
Error code: codingerror
Stack trace:
  • line 397 of \lib\setuplib.php: coding_exception thrown
  • line 2056 of \lib\outputrenderers.php: call to default_error_handler()
  • line 74 of \blocks\poll\tab_responses.php: call to core_renderer->user_picture()
  • line 65 of \blocks\poll\tabs.php: call to include()
 
In reply to Travis Wilhelm

Re: Poll Block

by Adam Olley -
Picture of Core developers Picture of Plugin developers

Hi Travis,

I've posted a small fix onto the copy of the code on github. The error appears to have been caused by trying to print a response for a user that no longer exists (deleted from the db).

If you still have issues, any additional info you can provide (like error screenshots like the one you've already provided) will be helpful.

Thanks!

In reply to Adam Olley

Re: Poll Block

by Travis Wilhelm -

Hi Adam,

Thanks for that - it fixes the responses page which now shows correctly.

BUT, I have problems getting to the configure block page - it just redirects to the home page.

The hyperlink is: http://xxx.edu.au/blocks/poll/tabs.php?action=configblock&cid=1&instanceid=4157

but this redirects to the homepage... 

BUT, I can edit the block by clicking directly via the front page - this URL is: http://xxx.edu.au/?sesskey=xxxxxxx&bui_editid=4157

Not sure why the links are so different, but I am guessing it might perhaps be a legacy moodle 1.9 link?

In reply to Adam Olley

Re: Poll Block

by Travis Wilhelm -

Adam, your prompt response / fix is highly impressive!! Thanks heaps!

Next thing: my aim is to provide a particular student with permissions to modify the poll. I have created a new roll called "Poll Manager" which can be applied to a block (but is based on the normal student roll), which has special permission to edit a block, and update the poll block.

It seems to work ok (allowing the student to view responses and setup new poll), except that when they create a new poll it comes up with an error:

error/You must be a teacher to perform this action

Is that something that is hard coded into the poll block or something I have done wrong with my permissions? From my quick look at the code it seems to be happening on line 63 which calls the function test_allowed_to_update($cid=0 and checks for the permission:     if(has_capability('block/poll:editpoll',$context)){ (

I've tried basing the permission on the Teacher ARCHETYPE, but this doesn't change anything.  See the attachmetn below for the permission which is explicitly set.

I am not an expert at permissions and may be missing something more fundamental - for example, do I need to set it at the course level as well, or the user level (but course level doesn't work because I am trying to apply this to the front page!).

Attachment edit_manage_poll.gif
In reply to Travis Wilhelm

Re: Poll Block

by Travis Wilhelm -

If anyone else is interested, I got around this issue ("error/You must be a teacher to perform this action") by creating it as a System role and assigning it on the Front Page to the person I wanted to be able to manage polls.

In reply to Adam Olley

Re: Poll Block

by Travis Wilhelm -

Adam,  I am still having a problem with the "configure block" button not working within this block.  Any advice to get this working?

In reply to Adam Olley

Re: Poll Block

by Ashutosh Bhardwaj -

Hi there !! 


I am having the same coding error on responses page.  I could not find the fix on the github repo as well. 


If anyone can please point me to the fix, that wud be great smile

In reply to Adam Olley

Re: Poll Block

by Kris KIm -

Hello Adam,

how to disable the guest to participate in the survey?

In reply to Kris KIm

Re: Poll Block

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Go to the course with the poll and switch to edit mode. Click on the Actions button (gear) for the poll block and select Permissions. For the View block line click on the x to the right of Guest and select Remove. That should do the trick. If you don't want them to even see the poll, then click on the + for Prohibit and select Guest so that guest will not even know the poll is there.

In reply to Paul Holden

Re: Poll Block

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

Hi,

I'm upgrading from Moodle 1.9.19 to 2.2.6, with the poll block changing from 2007072000 to 2011113000 and the database upgrade failed with:

Debug info: Unknown column 'anonymous' in 'mdl_block_poll'
ALTER TABLE mdl_block_poll ADD anonymous TINYINT(2) unsigned NOT NULL DEFAULT 0 AFTER anonymous

It looks like blocks/poll/db/upgrade.php is trying to create column 'anonymous' after column 'anonymous' which (obviously) doesn't exist yet. I had to change line 43 of upgrade.php to:

         $field->set_attributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', null);

All the best,

Leon