It allows you to create and customize polls for use in a Moodle course, and view detailed response information for them.
Paul
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.
Great idea.
Best of luck with it
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!
Dan
Looks great!
Kiril
Cheers
Mónico
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,
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
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
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
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
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.
Luis Perez
The standard poll block doesnt work in 1.9.3???
Let me know, and I will make it work!
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
I would love to get a version of your Poll Block. Is it available to download?
Thanks
John
I would really like to try your poll block.
Where can I get this from?
Many thanks
Hi Pablo,
Can we change the color of each bar?
Please help me in case you have any idea abt it......
Hello there, Pablo. How did you change the colors and added the percentages?
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
Any help would be great!
Thanks
Ed
Ed
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!
|
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:
I dont know, what can be the problem?
Under the Configure Poll label add some width to the Maximum graph width, perhaps 10.
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
Cheers
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
Moodle, by default, has a Poll activity called 'Choice' - maybe you could try that ?
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
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
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
Can you explain how to use this file you sent to install poll on 1.9?
Regards,
Juliano
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:
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
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.
Această postare pe forum a fost eliminată
hi, Leo
i also got this error, if u have solution then please post me..
thnx
shail
hi Leo ,
thnx for quick reply i got this error when i use poll block .
thnx
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
Hi Joe,
You may already have a solution but Turning Technologies has released their Moodle Module which can accomodate your requests. Please contact me at trooks@turningtechnologies.com.
Tina
Today I download the poll zip file and i upload that into mod directory.
In broswer i tried to install.
I am getting error :
Rishi
This is a block, not a module. You should install it in the blocks directory.
Regards,
John
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 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
Kindest Regards Daran
Thanks,
Mat.
You also need to copy the install.xml in the db folder present inside poll folder.
I have attahced the file also.
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.
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
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...
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
(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.
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.
Looking forward to the new version of this block.
Greeting from Cambodia,
Soben
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
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?
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.
Are there any plans to develop the poll block for Moodle 2.0?
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!
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.
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.
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.
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:
- 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
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
Many thanks,
Got it working in 2.2 dude, cheers.
Mark
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!
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.
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
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:
- formal/polite/speaking to adults (lang-bundle: de)
- 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... So, I'm working on it to make it useable in both settings.
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" ä, ö, ü.)
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?
-------------------------
Error code: codingerror
- 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()
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!
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?
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:
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.
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.
Adam, I am still having a problem with the "configure block" button not working within this block. Any advice to get this working?
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
Hello Adam,
how to disable the guest to participate in the survey?
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.
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