- Posts: 27
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Get surveyid in session.
- Marksom
- Topic Author
- Offline
- Junior Member
Less
More
9 years 2 months ago #115929
by Marksom
Get surveyid in session. was created by Marksom
Hello team Limesurvey.
At the end of each quiz, I have a script that does some checks on a database.
I need to know how to get the surveyid through a session in this script, something like: $ surveyid = $ _ SESSION .
I have not figured out how to get the surveyid through a session.
Thank you, now.
At the end of each quiz, I have a script that does some checks on a database.
I need to know how to get the surveyid through a session in this script, something like: $ surveyid = $ _ SESSION .
I have not figured out how to get the surveyid through a session.
Thank you, now.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13910
- Thank you received: 2548
9 years 2 months ago #115938
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 Get surveyid in session.
Hi,
Better/easiest solution is
- Use {SAVEDID} in the endurl : myscript.php?srid={SAVEDID}
- Use {SAVEDID} in a ajaxurl
- Use afterSurveyComplete plugin event and do your own plugin (surely the better solution).
Else : you have to start the $_SESSION before your script, with the same sessionname ....
Better/easiest solution is
- Use {SAVEDID} in the endurl : myscript.php?srid={SAVEDID}
- Use {SAVEDID} in a ajaxurl
- Use afterSurveyComplete plugin event and do your own plugin (surely the better solution).
Else : you have to start the $_SESSION before your script, with the same sessionname ....
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 following user(s) said Thank You: Marksom
The topic has been locked.
- Marksom
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 27
- Thank you received: 1
9 years 2 months ago #116011
by Marksom
Replied by Marksom on topic Get surveyid in session.
Thank you, thank you Denis.
I'll use url end, but I will try to implement a plugin
bye.
I'll use url end, but I will try to implement a plugin
bye.
The topic has been locked.
- Marksom
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 27
- Thank you received: 1
9 years 3 weeks ago - 9 years 3 weeks ago #117686
by Marksom
Replied by Marksom on topic Get surveyid in session.
Hello.
I tried to create the plugin, it active, but does not send the id.
Am I doing something wrong?
I tried to create the plugin, it active, but does not send the id.
Am I doing something wrong?
Code:
<?php class GetId extends PluginBase { protected $storage = 'DbStorage'; static protected $name = 'GetId'; static protected $description = 'Get id survey'; public function __construct(PluginManager $manager, $id) { parent::__construct($manager, $id); $this->subscribe('beforeSurveySettings'); } public function beforeSurveySettings() { if (!isset($_SESSION)) session_start(); $_SESSION['myid']=$_SESSION['survey_'.$surveyid]['scid']; } } ?>
Last edit: 9 years 3 weeks ago by Marksom. Reason: Error publication
The topic has been locked.
- Marksom
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 27
- Thank you received: 1
9 years 2 weeks ago #117728
by Marksom
Replied by Marksom on topic Get surveyid in session.
I tried that, but it did not work.
I need to create a plugin that pass the id in the redirect.
My version is 2.05+.
Any solution, please.
Thanks.
I need to create a plugin that pass the id in the redirect.
My version is 2.05+.
Any solution, please.
Thanks.
Code:
class GetId extends PluginBase { protected $storage = 'DbStorage'; static protected $name = 'GetId'; static protected $description = 'Get id survey'; public function __construct(PluginManager $manager, $id) { parent::__construct($manager, $id); $this->subscribe('afterSurveyComplete'); } public function afterSurveyComplete() { if (!isset($_SESSION)) session_start(); $_SESSION['myid']=$event->get('responseId'); } }
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13910
- Thank you received: 2548
9 years 2 weeks ago #117821
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 Get surveyid in session.
Hi,
Think using Yii is better (session name etc ...)
Try:
Think using Yii is better (session name etc ...)
Try:
Code:
public function afterSurveyComplete() { Yii::app()->session['myOwnSessionId']=$event->get('responseId'); }
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.
- Marksom
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 27
- Thank you received: 1
9 years 1 week ago - 9 years 1 week ago #118001
by Marksom
Replied by Marksom on topic Get surveyid in session.
Hi Denis.
I'm sorry, but I could not with Yii.
Edited a plugin Demo (ShowResponse) and it worked.
It was so for those who wish ...
Should create my own, but I'm not good at it.
I just want to see it working.
Thanks!
I'm sorry, but I could not with Yii.
Edited a plugin Demo (ShowResponse) and it worked.
It was so for those who wish ...
Code:
class GetId extends PluginBase { //protected $storage = 'DbStorage'; static protected $description = 'Get id survey'; static protected $name = 'GetId'; public function __construct(PluginManager $manager, $id) { parent::__construct($manager, $id); /** * Here you should handle subscribing to the events your plugin will handle */ $this->subscribe('afterSurveyComplete', 'getmyId'); } /* * Below are the actual methods that handle events */ public function getmyId() { $event = $this->getEvent(); $surveyId = $event->get('surveyId'); $responseId = $event->get('responseId'); if (!isset($_SESSION)) session_start(); $_SESSION['myId'] = $responseId; } }
Should create my own, but I'm not good at it.
I just want to see it working.
Thanks!
Last edit: 9 years 1 week ago by Marksom. Reason: text error
The topic has been locked.
- Mazi
- Offline
- Official LimeSurvey Partner
8 years 8 months ago #122476
by Mazi
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Replied by Mazi on topic Get surveyid in session.
Thanks for sharing your solution. Since e have update the limesurvey.org website recently, maybe you can upload your plugin there:
www.limesurvey.org/en/community-services...ons/76-survey-taking
Thanks!
BTW, did you test if this also works with the latest Limesurvey 2.06 version?
Thanks!
BTW, did you test if this also works with the latest Limesurvey 2.06 version?
Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.