- Posts: 23
- Thank you received: 6
Ask the community, share ideas, and connect with other LimeSurvey users!
<?php class ShowResponse extends PluginBase { protected $storage = 'DbStorage'; static protected $description = 'Demo: handle a survey response'; static protected $name = 'Show response'; public function init() { /** * Here you should handle subscribing to the events your plugin will handle */ $this->subscribe('afterSurveyComplete', 'logEvent'); $this->subscribe('afterModelSave', 'logEvent'); $this->subscribe('afterSurveyDynamicSave','logEvent'); $this->subscribe('afterSurveySave','logEvent'); $this->subscribe('afterResponseSave','logEvent'); } /* * Below are the actual methods that handle events */ public function logEvent() { $event = $this->getEvent(); $this->log($event->getEventName(). ' was triggered successfully.'); } }
2019/04/01 17:11:34 [trace] [plugin.Show response] afterSurveyDynamicSave was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] afterModelSave was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:34 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:43 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:43 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:43 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully. 2019/04/01 17:11:52 [trace] [plugin.Show response] afterSurveyComplete was triggered successfully. 2019/04/01 17:11:52 [trace] [plugin.Show response] getPluginTwigPath was triggered successfully.
$surveyId = Yii::app()->getRequest()->getParam("sid");
$session = Yii::app()->session['survey_'.$surveyId]
$srid = isset($session['srid']) ? $session['srid'] : null;