Dealing with Poll results

Dealing with Poll results

Thursday 29 October 2009 3:28:10 pm - 1 reply

Author Message

Gaetano Giunta

Friday 30 October 2009 1: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

Principal Consultant International Business
Member of the Community Project Board

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.