Community day

At the eZ Winter Conference 2010, meet up with the community in Geneva, jan. 21st.
Register and read more here.

Dealing with Poll results

Thursday 29 October 2009 11:28:10 pm

Hi,

Has anyone here handled a situation where they built an interface to store and retrieve poll results? Our current setup allows people to create normal objects but when they are called the view template converts it to xml which is then processed using smarty templates and html/css.

For the Poll, if we were to send the poll object in xml, could anyone recommend how we could send back the selection and also keep track of the results?

thanks.

Member since: 05/05/2009

Postings: 30

Replies


0 Thumbs up!

Friday 30 October 2009 9:56:23 am

ezsurvey is good enough for polls - it might just need a custom fetch to make it easy to retrieve the results: fetchSurveyResultBySessionID

    static public function fetchSurveyResultBySessionID( $surveyID )
    {
        $http = eZHTTPTool::instance();
        $sessionID = $http->sessionID();
        $surveyResultObject = false;
        if($surveyID)
        {
            $surveyResultObject = eZPersistentObject::fetchObject( eZSurveyResult::definition(),
                                                               null,
                                                               array( 'user_session_id' => $sessionID,
                                                                      'survey_id' => (int)$surveyID ) );
        }
        if ( $surveyResultObject === null || $surveyResultObject === false )
        {
            $retVal = array( 'error' => array( 'error_type' => 'kernel',
                                               'error_code' => eZError::KERNEL_NOT_FOUND ) );
        }
        else
        {
            $retVal = array( 'result' => $surveyResultObject );
        }
        return $retVal;
    } 

or you can use ezvotecollector

Member since: 28/08/2007

Postings: 540

You must be logged in to post messages in this topic.

Powered by eZ Publish® Content Management System. Copyright © 2009 eZ Systems AS (except where otherwise noted). All rights reserved.