If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
Messages posted by: Michael_C
Forum Index » Profile for Michael_C » Messages posted by Michael_C
Author Message
I've added a front end to Advanced poll, to display a list of all "active" polls. Each poll on this list can have a "vote" or "view results" button, which depends on wheter a member has already voted or not on a given poll. It worked fine on the old site, but I'm now trying to migrate it to the new site which is using mambo. The first step I took was to see if I could get the poll list to display correctly using a hard coded user id. This worked fine, and it displayed all of the active polls with the appropriate "vote" and "view results" buttons for the user (hard coded). However, I had no success when I removed the hard coded user id, and tried to get the id for the currently logged on user, from the session array.
This brings me to where I'm at now. Instead of having the mambo menu item link directly to poll's index.php file, I had it link to a new script, prepoll.php, whose job was going to be to get the user information and make the info available to poll's index.php - In a test, I made some "play" info visible to index.php, however the displaying of the poll index didn't occur. For the poll list to be displayed, index.php is to be executed twice. The first time $action var is not set, and the default of the case statement (below) is called. poll_index() is a function in index.php, and it would normally execute when the case stament's default is hit.



When I use prepoll.php I have the following line of code
to call index.php.
It goes into index.php fine, dummy/text info is passed to it from prepoll.php, and it goes into the default section of the case statement. However, it doesn't execute poll_index(), because it never goes back into index.php.

Is the include I have in prepoll the problem?
In order to make the session array work correctly in the old site I had to make sure the session array was referenced relative to the domain by using ini_set - e.g., ini_set('session.cookie_domain','.mydomain') ;
I don't have full freedom in the mambo environment, so I thought I could use mambo's get_user() function in prepoll.php and set the session array the way I need it to be set.

Maybe the crux of my question is: How, in php, do you call script B from script A so script B runs the same way as if script B was executed directly?
It looked like poll_extend() does something similar to what I'm wanting to do. There may be better choices, but what I'm trying to do is create a table with three colunns. The table will conain a list of all active polls where a member has yet to vote.
Column ---- Contains
1 ----- poll title($question),
2 ----- link for the primary member to display the poll,
3 ----- link for the secondary member (typically a spouse) to display the poll

I saw things in poll_extend that I didn't follow, and thought seeing "who" called it might clarify things. One of the things I didn't understand was the call to create_javascript_array(). Anyway, at first I thought it was called in is_valid_poll_id() which, soon brought up additional conufusion.
There may be a better example of how to display the table with the links, but would like to know if the code in is_valid_poll() below line 183 ever executes.

This is most likely a php question - I thought I was starting to understand php, and how the php engine works, until I saw the code in is_valid_poll_id().
I have the latest vesion of Advanced Poll, and wonder if the code after line 183 could ever be executed.
Line 184 is: "if (!isset($poll_id) || !is_valid_poll_id($poll_id)) {"
I included a snippet of lines 174 thru 188 in the php file -poll_extend() was called in line 205.
Is this an error, or can it actually be executed?

Any help would be appreciated.
Michael

One of the features I need, is to have polls where more than one choice can be selected. It doesn't look like the Advanced Poll accomodates this now - Has anyone made this change?

I can see needing to change:
- the template to use checkboxes instead of radio buttons,
- add another poll property to set "Max pick"
- either change update_poll() to accept/process an option_id array, or make multiple calls to update_poll() from within poll_process()
- a way to let the voter know how many more picks they have

Have I overlooked any big gotcha's? Any suggestions or examples for any part/all would be greatly appreciated.

TIA,
Michael
I'm trying to set up the advanced poll to allow approx 1000 members to vote. Someone else installed "Advanced poll" and got as far as entering a small demo. It is using the Db side of the code, and I have had no luck, to date, in finding where the databases are stored. Before I spend any more time, I thought I would see if anyone has a tip on a quick way to find out - Is there a config file that tells the location?

I will be modifying the app to allow more than one person who shares the same membership id to vote (e.g., husband and wife each getting their own vote, but have only one membership id).
I'm planning on modifying has_voted in class_poll.php to accept the poll_id, user_id, and username. has_voted() would check the "voter history log" that I'll create, and return true if there is an entry. I figure the size of the table will be relatively small, and shouldn't be much of a hit. Is this a reasonable assumption?
I'll have to deal with the updating the voter history log - once I locate the function that currently creates the cookie.

Any insights would be greatly appreciated.

Michael
 
Forum Index » Profile for Michael_C » Messages posted by Michael_C
Go to:   
Based on the open source JForum