Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Different databases for one limesurvey system?

Different databases for one limesurvey system? 1 Jahr 8 Monate her #91987

  • jesovn
  • jesovns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Hi, I'm actually developing an application that uses Limesurvey.

This application needs different databases, one for each "department".

I've created different LimeSurvey databases. For that, I modify the Surveys URL, adding a parameter to this URL. Looks like this:

http://localhost/proyect/limesurvey/index.php/survey/index/sid/189169/token/f66y3gkdhdgnwt?departmentid=1

The "index.php" stores in SESSION the "departmentID", and then the "config.php" reads this SESSION variable to switch between different databases. It works for doing the surveys, and if I want to enter into the admin page it also works with this URL:

http://localhost/proyect/limesurvey/index.php/admin?departmentid=1

But with the remotecontrol2 it doesn't work. My application stores in SESSION the departmentID, but when I use the RemoteControl I can't get the sessionKey (there's an exception).

I'd like to know how I could configure the remotecontrol to switch between different databases like in the other use. Or if it is possible to send this parameter to the remotecontrol....

Please help, the only other solution is to have a limesurvey proyect for each department. I know that it isn't an usual use of limesurvey... but could be nice to modify Limesurvey to have this capability.

Thanks in advance! Best regards,
Jesus
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: Different databases for one limesurvey system? 1 Jahr 8 Monate her #92023

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6429
  • Dank erhalten: 839
  • Karma: 249
Hello,

With different server name, it's "relative" easy.

You can test the server name in config.phpo and set the detabase according to the servername.

For example:
$thishost=$_SERVER['HTTP_HOST'];
if($thishost=="localhost"){
  $connectionString='mysql:host=localhost;port=3306;dbname=ls_localhost;'
}else{
  $connectionString='mysql:host=localhost;port=3306;dbname=ls_web;'
}

And change the array with:
'components' => array(
		'db' => array(
			'connectionString' => $connectionString,

Here, LS use is own session_name, think it's difficult to tak session var from another session before using session of LimeSurvey.

Maybe another idea is to have symbolic link for limesurvey directory and test the dirname of config.php to set the $connectionString.

Denis
Letzte Änderung: 1 Jahr 8 Monate her von DenisChenu. Begründung: remove extra "
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: jesovn

Re: Different databases for one limesurvey system? 1 Jahr 8 Monate her #92036

  • jesovn
  • jesovns Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Thank you DenisChenu!! I've solved it! =D Very useful!
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.260 Sekunden
Donation Image