Project:Advanced Poll
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

I would like to be able to filter polls in views by status, if it is closed or open.

Comments

#1

Status:active» needs review

Here'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).

AttachmentSize
advpoll-views.patch 5.86 KB

#2

Hey, well done :) To what extent have you tested this with different advpoll settings?

#3

I only did the "option" value type used by binary polls.

#4

Version:5.x-1.x-dev» 6.x-1.x-dev
Status:needs review» patch (to be ported)

Okay 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

#5

Any plans to make a version 6 commit for rudementary views integration?

#6

Subscribing - would like to see this in views for D6 as well!

#7

Subscribing. I need this esp. to be able to show various polls in blocks depending on arguments.

#8

Is 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...

#9

+1 for "total votes"

#10

Status:patch (to be ported)» needs review

Here's a start to integrate Adv.Poll in Views for Drupal 6:

1) Edit advpoll.module and add the following:

<?php
/**
* Implementation of hook_views_api().
*/
function advpoll_views_api() {
  return array(
   
'api' => 2,
   
'path' => drupal_get_path('module', 'advpoll') .'/views',
  );
}
?>

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.

#11

The file was not attached in the previous post for some reason. Sorry.

AttachmentSize
advpoll.views.inc 2.21 KB

#12

Assigned to:Anonymous» miro_dietiker
Status:needs review» reviewed & tested by the community

Great progress, markus.
Looks good to me and dereine also confirmed that this should be fine.
Assigning to me to commit it soon.

#13

Status:reviewed & tested by the community» fixed

Tested and committed to cvs. Thank you markus.

#14

Assigned to:miro_dietiker» Anonymous

unassigning

#15

subscribe

#16

I 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

#17

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.