Commit d7f6571d authored by Chenu Denis's avatar Chenu Denis

[feature] Allow to set diffent session name by survey

parent 67b1e320
# Set different session name for each public survey
Allow to send token email (invite or reminder) via PHP cli . This allow to use crontab or Scheduled task to send email.
## Usage
This plugin is only tested with LimeSurvey 3.10 but must work with all LimeSurvey version after 2.50 build 160425
This plugin use session, then need an update on config, you must set autostrat to false :
````
'components' => array(
'db' => array(
[…]
'session' => array (
'autoStart' => false,
'sessionName' => "LimeSurvey",
),
[…]
),
````
## Home page & Copyright
- HomePage <http://extensions.sondages.pro/sendmailcron/>
- Copyright © 2018 Denis Chenu <http://sondages.pro>
<?php
/**
* sessionNameBySurvey
*
* @author Denis Chenu <denis@sondages.pro>
* @copyright 2018 Denis Chenu <http://www.sondages.pro>
* @license GPL v3
* @version 0.0.1
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
class sessionNameBySurvey extends PluginBase {
protected $storage = 'DbStorage';
static protected $description = 'Use a different session name by survey';
static protected $name = 'sessionNameBySurvey';
function init()
{
$this->subscribe('beforeControllerAction');
}
public function beforeControllerAction() {
$controller = App()->getController()->getId();
if($this->getEvent()->get('controller') == 'survey') {
$sid = App()->getRequest()->getParam('surveyid',App()->getRequest()->getParam('sid'));
$currentName = App()->getSession()->getSessionName();
App()->getSession()->setSessionName($currentName.'_survey_'.$sid);
}
if(!App()->getSession()->isStarted) {
App()->getSession()->open();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment