- Posts: 10
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to display responses of questions that are "long text" type?
- hagerregah
-
Topic Author
- Offline
- New Member
-
Less
More
2 years 5 months ago #206433
by hagerregah
I created a plugin that creates a new menu entry. The function I aim at is to display, for a given survey, the list of answers of questions that are of "long text" type.
How can I do it?
How can I do it?
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 12895
- Thank you received: 2371
2 years 5 months ago #206437
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic How to display responses of questions that are "long text" type?
Moving to developement …
You need to
1. Create a page using github.com/LimeSurvey/LimeSurvey/blob/10...PluginHelper.php#L21 sidebody action on PluginHelper (I don't see example in core survey, but you must create a pluginmanager/sidebody url
2. Create a findAll request $question => \Question::model()->findAll("sid = :sid and type = :type"), array(":sid" => $surveyId,":type" => 'T'
3. When you have it : make a for each function to get the values for Response::model($surveyId)->findAll()->getAttribute($question->sid."X".$question->gig."X".$question->qid);
You have all information to do your own system, remind you can check existing source code …
You need to
1. Create a page using github.com/LimeSurvey/LimeSurvey/blob/10...PluginHelper.php#L21 sidebody action on PluginHelper (I don't see example in core survey, but you must create a pluginmanager/sidebody url
2. Create a findAll request $question => \Question::model()->findAll("sid = :sid and type = :type"), array(":sid" => $surveyId,":type" => 'T'
3. When you have it : make a for each function to get the values for Response::model($surveyId)->findAll()->getAttribute($question->sid."X".$question->gig."X".$question->qid);
You have all information to do your own system, remind you can check existing source code …
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- hagerregah
-
Topic Author
- Offline
- New Member
-
Less
More
- Posts: 10
- Thank you received: 0
2 years 5 months ago - 2 years 5 months ago #206449
by hagerregah
Replied by hagerregah on topic How to display responses of questions that are "long text" type?
@DenisChenu
So this is the code:
I could display the questions but not the responses: it says
Should I change the "X" in the script?
Thank you in advance.
So this is the code:
Code:
$questions = \Question::model()->findAll("sid = :sid and type = :type", array(":sid" => $iSurveyID,":type" => 'T')); $question = []; foreach ($questions as $q) { $question[$q->title] = $q; //echo $q->question; } //print_r ($question); $responses = []; foreach ($questions as $q) { $responses =Response::model($iSurveyID)->findAll()->getAttribute($q->sid."X".$q->gig."X".$q->qid); } print_r ($responses);
I could display the questions but not the responses: it says
500: Internal Server Error
Call to a member function getAttribute() on array
Should I change the "X" in the script?
Thank you in advance.
Last edit: 2 years 5 months ago by hagerregah.
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 12895
- Thank you received: 2371
2 years 5 months ago #206506
by DenisChenu
See www.yiiframework.com/doc/api/1.1/CActiveRecord#findAll-detail
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic How to display responses of questions that are "long text" type?
Code:
$oResponses = Response::model($iSurveyID)->findAll(); foreach($oResponses as $oResponse) { foreach ($questions as $q) { $responses[] = $oResponse->getAttribute($q->sid."X".$q->gig."X".$q->qid); } }
See www.yiiframework.com/doc/api/1.1/CActiveRecord#findAll-detail
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.