Create Custom Forms to add Participants to the CPDB

More
4 weeks 2 days ago #159919 by luckylokian
luckylokian created the topic: Create Custom Forms to add Participants to the CPDB
Hi,

I am currently running on the latest stable 2.67.2.

At the moment, I am planning to customize the Entry-Procedure for the CPDB without the need of a CSV Import Step

Several users should be able to add their specific participants by using a previously customized form.

Now I am looking for the best approach.


For example:

A Custom-Attribute-Field "Institution" (Drop-Down) is implemented and the User chooses "Institution XY", the fields Telephone / Address are autofilled by JavaScript for this specific "Institution XY". The assignment of XY and their specfic number/address is handled by JavaScript and a JSON-File on the server.

1. This first approach would require to change the code of the standard form in the backend files...


My first thought was to use a plugin for this, but the lack of CPDB-support in the API prevented this approach.

2. This second approach would involve something like: "Generating a CSV with PHP and transfer this file to the CPDB each time a new participant is added by a user".


3. Probably, the best idea would be to directly interact with the MySQL-DB by a PHP-File and implement it as a plugin to add new participants to the CPDB.


Do you have any advice on this? Should I go with approach three? Are there any massive problems with a direct access to the DB? What happens if multiple Users using the form at the same time?



Thanks a lot!

Please Log in to join the conversation.

More
3 weeks 6 days ago #159961 by DenisChenu
DenisChenu replied the topic: Create Custom Forms to add Participants to the CPDB

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
3 weeks 4 days ago #160010 by luckylokian
luckylokian replied the topic: Create Custom Forms to add Participants to the CPDB
Thank you for fast reply.

I am new to all this Yii-Stuff. Could you specify your answer?

Is there a simple PoC to write a Token to the CPDB by NewDirectRequest?
I try to dive into the Plugin Development by reverse engineering the MassAction-Plugin but it is a little overwhelming....

I am currently able to make Post-Request to my Plugins index.php and getting Data from my Plugins.php.

But I am not sure about the cleanest way to use the Yii-db -Syntax to add a participant and its attributes to the database by given POST-data. (without checking User Permissions)

Thanks in advance

Please Log in to join the conversation.

More
3 weeks 3 days ago #160080 by DenisChenu
DenisChenu replied the topic: Create Custom Forms to add Participants to the CPDB
I think of maling such plugin since a lot of time, but no client interested, maybe i must make a contribution call for this … (like to have something like www.bountysource.com but for non existing project).

You must use Yii Active Record directly
My point of view :
1. Create a completly clean new page (you already done)
2. Add an identification page with user/pass
3. This page just have a "user/password" form
4. To register or update other part : use a LimeSurvey Survey and afterSurveyComplete event

reverse engineering the MassAction-Plugin

It's NOT reverse engineering, reverse engineering is when you don't have the source code, but only compiled code. For example LibreOffice dev team must reverse engineering Word to do the .doc adaptation.

It's free code example. You have other's here : framagit.org/SondagePro-LimeSurvey-plugin

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!