I would like to be able to filter polls in views by status, if it is closed or open.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | advpoll.views.inc | 2.21 KB | markus_petrux |
| #1 | advpoll-views.patch | 5.86 KB | floretan |
I would like to be able to filter polls in views by status, if it is closed or open.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | advpoll.views.inc | 2.21 KB | markus_petrux |
| #1 | advpoll-views.patch | 5.86 KB | floretan |
Comments
Comment #1
floretan commentedHere's a patch that adds views integration to the advpoll module. The code is mostly based on the views integration of the VotingAPI, but modified to pick up the data from the advpoll module (which differs slightly from the VotingAPI data, even though it's stored in the same table).
Comment #2
ChrisKennedy commentedHey, well done :) To what extent have you tested this with different advpoll settings?
Comment #3
floretan commentedI only did the "option" value type used by binary polls.
Comment #4
ChrisKennedy commentedOkay I went though this, added a little support for {advpoll} fields so you can filters polls by open/closed status, and committed.
http://drupal.org/cvs?commit=166835
Comment #5
browlands commentedAny plans to make a version 6 commit for rudementary views integration?
Comment #6
Apollo610 commentedSubscribing - would like to see this in views for D6 as well!
Comment #7
vacilando commentedSubscribing. I need this esp. to be able to show various polls in blocks depending on arguments.
Comment #8
Anonymous (not verified) commentedIs there any ability to create additional field/sort criteria/filter in Views for this module? It would be great to have "Total votes" field in Views for node with pollfield applied. Or sort to display 10 most voted polls, for example...
Comment #9
travis.hill commented+1 for "total votes"
Comment #10
markus_petrux commentedHere's a start to integrate Adv.Poll in Views for Drupal 6:
1) Edit advpoll.module and add the following:
2) Create the 'views' subdirectory in the advpoll folder and upload the attached file as advpoll.views.inc
This file creates a Views group for Advanced Polls fields, filters and so on. It implements the poll active state, the question and start/end dates. It's just a start and maybe other wish to add more stuff. This has been enough for us.
Comment #11
markus_petrux commentedThe file was not attached in the previous post for some reason. Sorry.
Comment #12
miro_dietikerGreat progress, markus.
Looks good to me and dereine also confirmed that this should be fine.
Assigning to me to commit it soon.
Comment #13
miro_dietikerTested and committed to cvs. Thank you markus.
Comment #14
miro_dietikerunassigning
Comment #15
yngens commentedsubscribe
Comment #16
Vector- commentedI think this is related ... I just needed the Views Relationships to get the correct joins to apply some custom filters
VotingAPI provides a hook for custom content_types for its relationships - though is output leaves something to be desired...
None the less, I've found it quite handy for what I'm doing, and I'd imagine it could be extended to quite a number of other uses
I haven't bothered to put up a patch, since my solution produces a somewhat un-intuitive experience:
Since it's still on node basetable, VotingAPI only changes the description text of the relationship, and otherwise it appears a duplicate of the normal 'Node: Vote Results' ...
This already has its own issue: #553350: Views Relationship / VotingAPI integration seems incorrect due to content_type
But as I noted there... AdvPoll doesn't store data the way VotingAPI expects it, so for a more intuitive experience, custom relationship handlers would be needed