LimeSurvey issue tracker
Registration

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
08633Development [All Projects] RemoteControlpublic2014-01-30 15:592014-02-03 11:43
Reportermmirasol 
Assigned Totrougakoss 
PrioritynormalSeverityminor 
StatusassignedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary08633: API functions for Export Survey, Import Survey, Activate Survey, Deactivate Survey
DescriptionWe are currently trying to develop a survey test tool which allows us to generate test links over surveys developed in lime. What we want to do primarily is point our test tool to the second instance so that all test data is separated from real data.

The challenge here is that we want the second instance to be completely controlled by the first instance so that whenever any changes are made to the first these are also replicated on the second so that we don't have to export, import and activate manually.

Examples:
1. When a survey is activated on the first instance, the survey is exported and imported in the second instance and also activated.
2. If a survey is deactivated on the first instnace, it will also be deactivated on the second instance.
3. If any changes are made the survey on the first instance, these are also replicated on the second.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
User avatar (28285)
mmirasol (reporter)
2014-01-30 18:08

Hello guys. I'm currently working with a copy of limesurvey 2.00. And I'm trying to figure out where the helpers in the remote control API are being loaded from.

Example: in the activate_survey function, I see:

Yii::app()->loadHelper('admin/activate');
$aActivateResults = activateSurvey($iSurveyID);

I would like to ask what admin/activate is referring to.
Secondly, I would like to ask where the activateSurvey function is defined.

If you can point me in the right direction, I believe I should be able to figure out how the API works and come up with the missing functions that we need.
User avatar (28288)
Mazi (developer)
2014-01-30 22:28

trougakoss, since you have been working on the API a lot, maybe you can provide some help?
User avatar (28289)
sammousa (developer)
2014-01-30 22:59

hi mmirasol,
Some of your questions can be answered rather simply.
1. activateSurvey is defined in application/protected/helpers/admin/activate_helper.php (you can easily find this by using ctrl+click where the function is used; in most IDEs that takes you to the declartion) (alternatively just use a find in files function, present in almost all IDEs and editors to find all occurences of "function activateSurvey".

2. Internally activating a survey should be done in the Survey model. Currently this code is located in the helper file mentioned in 1, ideally one would activate a survey with the following code:

Survey::model()->findByPk(12354)->activate();

3. From a plugin we provide the LimesurveyApi object; currently this object has functions like getToken and getResponses, a function getSurvey can easily be added.
Activating a survey would then look like this:

$this->api->getSurvey(12345)->activate(); // Obviously in reality you would want to check for a return value != null to prevent errors.

Good luck!
User avatar (28290)
sammousa (developer)
2014-01-30 22:59

Also, use 2.05
User avatar (28308)
trougakoss (developer)
2014-01-31 13:19

Hello mmirasol, if there is something i can help you with (that is not already answered), please let me know
User avatar (28329)
mmirasol (reporter)
2014-01-31 15:45

Thank you, trougakoss and sammousa. Currently, our web server is running on php 5.1 so we cannot use 2.05 yet. And we have other applications running on this server so we cannot upgrade without checking the impact yet.

So now, we can only work with lime 2.00.

sammousa, lime 2.00 does not have a protected folder, but I see application/helpers/admin/activate_helper.php is there. Is it correct to assume the any references to the protected folder is pointing directly to the application folder?

secondly, how does the Yii::app()->loadHelper('admin/activate');
function work? Where can I find a list of helpers that I can load?
User avatar (28364)
mmirasol (reporter)
2014-02-01 04:43

I also have a question about json-rpc. Is it a php class that needs to be enabled? I cannot connect to my local instance of limesurvey running on wampserver but I can connect to another instance that's hosted online. Please advise what I should check so I can work locally.
User avatar (28433)
Mazi (developer)
2014-02-03 11:39

Which PHP versions are used on the two systems?
User avatar (28434)
Mazi (developer)
2014-02-03 11:41
edited on: 2014-02-03 11:43

Have a look at http://manual.limesurvey.org/RemoteControl_2_API#PHP_Example [^] for a PHP example and library.

According to https://code.google.com/p/json-rpc-stomp-simple/source/browse/trunk/Php/test-json-rpc.php?r=5 [^] you may need to include an additional file.


- Issue History
Date Modified Username Field Change
2014-01-30 15:59 mmirasol New Issue
2014-01-30 18:08 mmirasol Note Added: 28285
2014-01-30 22:25 Mazi Project Bug reports => Development
2014-01-30 22:28 Mazi Assigned To => trougakoss
2014-01-30 22:28 Mazi Status new => assigned
2014-01-30 22:28 Mazi Note Added: 28288
2014-01-30 22:59 sammousa Note Added: 28289
2014-01-30 22:59 sammousa Note Added: 28290
2014-01-31 13:19 trougakoss Note Added: 28308
2014-01-31 15:45 mmirasol Note Added: 28329
2014-02-01 04:43 mmirasol Note Added: 28364
2014-02-03 11:39 Mazi Note Added: 28433
2014-02-03 11:41 Mazi Note Added: 28434
2014-02-03 11:43 Mazi Note Edited: 28434 View Revisions


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker