Share » Forums » Developer » ezsurvey ext 'forgets' questions...

ezsurvey ext 'forgets' questions (because of php4.4/ez3.7??)

ezsurvey ext 'forgets' questions (because of php4.4/ez3.7??)

Thursday 18 August 2005 4:15:46 pm - 5 replies

Author Message

Siniša Šehović

Friday 27 January 2006 6:57:25 am

Hi Marin :-)

Did you find any solution for this problem?

S.

---
If at first you don't succeed, look in the trash for the instructions.

Kristof Coomans

Friday 27 January 2006 9:04:29 am

You will have to take a look at the code where the XML gets generated. I've solved similar problems with some datatypes. For a little article about how I did that, see http://blog.coomanskristof.be/2005/12/23/enhancedselection-fix-for-php-44/.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Kristof Coomans

Saturday 28 January 2006 2:44:58 am

Try out the following modifications, I think it should work then with PHP 4.4.x (eZ publish 3.7.x):

In <i>modules/survey/classes/ezsurveymultiplechoice.php</i>, replace the method encodeXMLOptions of the eZSurveyMultipleChoice class with the following code:

    function encodeXMLOptions()
    {
        $doc = new eZDOMDocument();
        $root =& $doc->createElementNode( "options" );
        $doc->setRoot( $root );
        
        $options = array();
        $optionLabel = array();
        $optionValue = array();
        $optionChecked = array();
        
        foreach ( $this->Options as $i => $optionArray )
        {
            $options[$i] =& $doc->createElementNode( "option" );
            $optionLabel[$i] =& $doc->createElementNode( "label" );
            $optionLabel[$i]->appendChild( $doc->createTextNode( $optionArray['label'] ) );
            $options[$i]->appendChild( $optionLabel[$i] );

            $optionValue[$i] =& $doc->createElementNode( "value" );
            $optionValue[$i]->appendChild( $doc->createTextNode( $optionArray['value'] ) );
            $options[$i]->appendChild( $optionValue[$i] );

            $optionChecked[$i] =& $doc->createElementNode( "checked" );
            $optionChecked[$i]->appendChild( $doc->createTextNode( $optionArray['checked'] ) );
            $options[$i]->appendChild( $optionChecked[$i] );

            $root->appendChild( $options[$i] );
        }
        $this->Text2 =& $doc->toString();
    }

In <i>modules/survey/classes/ezsurveyreceiver.php</i>, replace the method encodeXMLOptions of the eZSurveyReceiver class with the following code:

    function encodeXMLOptions()
    {
        $doc = new eZDOMDocument();
        $root =& $doc->createElementNode( "options" );
        $doc->setRoot( $root );

        $options = array();
        $optionLabel = array();
        $optionValue = array();
        $optionChecked = array();
        
        foreach ( $this->Options as $i => $optionArray )
        {
            $options[$i] =& $doc->createElementNode( "option" );
            $optionLabel[$i] =& $doc->createElementNode( "label" );
            $optionLabel[$i]->appendChild( $doc->createTextNode( $optionArray['label'] ) );
            $options[$i]->appendChild( $optionLabel[$i] );

            $optionValue[$i] =& $doc->createElementNode( "email" );
            $optionValue[$i]->appendChild( $doc->createTextNode( $optionArray['value'] ) );
            $options[$i]->appendChild( $optionValue[$i] );

            $optionChecked[$i] =& $doc->createElementNode( "checked" );
            $optionChecked[$i]->appendChild( $doc->createTextNode( $optionArray['checked'] ) );
            $options[$i]->appendChild( $optionChecked[$i] );

            $root->appendChild( $options[$i] );
        }
        $this->Text2 =& $doc->toString();
    }

Good luck!

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Siniša Šehović

Monday 30 January 2006 12:59:18 am

Hi Kristof

Thanx for your help!!!

Now ezsurvey works as it should.

Best regards,
S.

---
If at first you don't succeed, look in the trash for the instructions.

Kristof Coomans

Monday 30 January 2006 1:11:17 am

You're welcome! ;-)

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

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

36 542 Users on board!

Forums menu