ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
dev.txt.php
Go to the documentation of this file.
1 <?php exit; ?>
2 
3 # Survey Question Pool (Modules/SurveyQuestionPool)
4 * Main question editing/storing
5 * Storing of phrases
6 
7 ## Question Types
8 * stored in table svy_qtype
9 * Can we get rid of legacy plugin architecture?
10 * Can we get of the table completely?
11 
12 ## Questions
13 * class SurveyQuestion (parent for specialized question classes)
14 * table svy_question (general question properties)
15  * questiontype_fi: question type -> svy_qtype
16  * obj_fi: survey or survey pool object -> object_data
17  * owner_fi: author user -> usr_data and object_data
18  * complete: 1 or 0 depending if the user saved any data
19  * original_id:
20  * ...
21 * Problem: If we do not save any answer and press "back to de Survey" or we leave this page without save.
22  In the "svy_question" we have the records "title" and "questiontext" with NULL values and also "complete" and
23  "tstamp" with value 0 (Look for services/cron which delete this rows)
24 
25 
26 
27 ### Single Choice Question
28 ...
29 
30 ### Multiple Choice Question
31 ...
32 
33 ### Metric Question
34 ...
35 
36 ### Matrix Question
37 ...
38 
39 ### Text Question
40 ...
41 
42 
43 ## Question "Categories" (General Answer Options)
44 * Categories are reused by all questions, depending on the category title (answer option text)
45 * If a question is edited and a category title (answer option) already exists, it
46  will be assigned to the question
47 * class ilSurveyCategory represents single category (but also holds "variable" data)
48  * title ("answer option text")
49  * other (if true, an additional text input field presented for free user input is presented)
50  * neutral (true: this is a neutral answer, ...)
51  * label ...
52  * scale (<- this will be stored in "Variables")
53 * class SurveyCategories handles an array of ilSurveyCategory objects (for a question)
54 * problem: neither ilSurveyCategory nor SurveyCategories writes into table svy_category this is done by
55  classes SurveySingleChoiceQuestion, SurveyQuesiton, SurveyMatrixQuestion and SurveyPhrases, ...
56 * table svy_category
57  * title: answer text
58  * defaultvalue: is set to "1" for categories predefined by the system? or for user defined phrases
59  * neutral:
60  * ..
61 
62 ## "Variables" (Answer Options of Concrete Questions)
63 * Answer options for each question
64 * Hold Scale Values
65 * table svy_variable
66  * category_fi: general answer option -> svy_category
67  * question_fi: question -> svy_question
68  * value1: for metric q: min value
69  * value2: for metric q: max value
70  * sequence: order of the options in the question presentation
71  * other:
72  * scale: scale value (positives or NULL. Here the scale have the real value entered, not scale -1 )
73 * problem: value1/value2 values seem to be redundant or belong to other tables (e.g. metric)
74 
75 
76 ## "Phrases"
77 * Reusable sets of answer options (only for single choice and matrix questions)
78 * table svy_phrase
79  * title (of the answer option set/phrase)
80  * defaultvalue...
81 
82 ## Phrase Categories (Answer options of phrase)
83 * table svy_phrase_cat
84  * phrase_fi -> phrase in svy_phrase
85  * category_fi -> general answer option in svy_category
86  * sequence: order of the options in the question presentation
87  * other:
88  * scale: always NULL?, editing provides only disabled input fields
89 * problem: why scale field when always NULL?
90 
91 
92 ## Question Editing
93 * Question GUI classes
94  * Save process: save() -> saveForm() -> importEditFormValues() -> question object saveToDb()
95 
96 
97 # Survey (Modules/Survey)
98 * Represents Survey Repository Object
99 * Manages question of survey
100 * Stores given answers
101 * ...
102 
103 ## Survey
104 * table svy_svy (general settings of the survey)
105  * obj_fi: general object -> object_data
106  * ...
107 
108 ## Questions in a survey
109 * table svy_svy_qst
110  * survey_fi: survey -> svy_svy
111  * question_fi: question -> svy_question
112  * sequence: ordering of the questions in the survey (increments +1 normally through question blocks)
113  * ...
114 
115 ## Compulsory questions in a survey
116 * Stores compulsory (obligatory/mandatory) state of each question in a survey
117 * problem: Why is this not a simple property in svy_svy_qst?
118 * table svy_qst_oblig
119  * survey_fi: survey -> svy_svy
120  * question_fi: question -> svy_question
121  * obligatory: 1 for true
122 
123 ## Question Block / Page
124 * All questions of a block will be presented on one page
125 * table svy_qblk
126  * title: block title
127  * show_questiontext: enables to show/hide question texts for questions of the block
128  * show_blocktitle: show/hide title of the block in presentation
129 
130 ## Question Block Questions
131 * Questions of a question block
132 * table svy_qblk_qst
133  * survey_fi: survey -> svy_svy
134  * question_fi: question -> svy_question (could have pointed to svy_svy_qst instead, but does not do)
135  * question_block_fi: block -> svy_qblk
136 
137 ## Rules/Routing
138 * General Idea: Conditional presentation of questions or question blocks (pages) depending on former answers
139 
140 ## Rule Relation
141 * <, <=, =>, ...
142 * table svy_relation (fixed set of relations, should be moved from table to class constants)
143  * longname, e.g. less
144  * shortname, e.g. <
145 * problem: why storing this in a table, its static?
146 
147 ## Rule / Condition Definition
148 * Rules can be defined using single choice, multiple choice and metric questions
149 * table svy_constraint
150  * question_fi: "source" question -> svy_question
151  * relation_fi: relation -> svy_relation
152  * value: scale value - 1 !?
153  * conjunction: or/and (but why on this level?)
154 
155 ## Rules / Condition used on a Question
156 * "If condition is met, show the question"
157 * table svy_qst_constraint
158  * survey_fi: survey -> svy_svy
159  * question_fi: "target" question -> svy_question
160  * constraint_fi: constraint definition -> svy_constraint
161 * problem: it seems that svy_constraint and svy_qst_constraint could be merged into one table
162 
163 ## Survey Run ("Finished")
164 * Stores progress of user working through a survey
165 * table svy_finished
166  * finished_id: autoincrement and pk of this table
167  * survey_fi: survey -> svy_svy
168  * user_fi: user -> usr_data (and object_data)
169  * anonymous_id:
170  * state: 1 if finished? 0 otherwise?
171  * lastpage:
172  * appr_id:
173 
174 ## Survey Run Access Times
175 * Access times to survey pages during a run. Back and forward navigation lead to multiple entries per run for a page
176 * table svy_times
177  * finished_fi: survey run -> svy_finished
178  * first_question: first question id of page/block -> svy_question (does not seem to point to svy_svy_qst)
179  * entered_page: timestamp when page has been rendered
180  * left_page: timestamp when answers of page have been saved
181 
182 ## Given Answers
183 * Given answers by user during test run, mc question answers may lead to multiple entries for one question in a run
184 * table svy_answer
185  * active_fi: survey run -> svy_finished
186  * question_fi: question -> svy_question (does not point to svy_svy_qst)
187  * value: scale value of corresponding "variable" -1?
188  * textanswer:
189  * rowvalue:
190 
191 ====================================
192 
193 ## Current behaviour without patch.
194 
195 ### scales doesn't allow 0 values. And this scales are saved with the scale value - 1 in the table "svy_answer"
196 
197 #### Web workflow
198 **As admin:**
199 
200 Repository home -> create new survey, create new page with any of this "Question type":
201 - Multiple Choice Question (Single Response)
202 - Multiple Choice Question (Multiple Response)
203 - Matrix Question
204 
205 **In the answers section:**
206 
207 
208 
209 - Problem:
210 
211 We can put as scale values everything without restrictions. Strings, numbers and symbols are allowed.
212 After pressing the save button we get the success message "Modifications saved."
213 But in the database table "svy_variable" the column scale has "NULL".
214 
215 - Problem:
216 
217 If we go to edit this answer we can see that the javascript filled the Scale with the first number available in the
218 scale values. Therefore we have NULL in the DB and one new number in the edit form.
219 
220 - Observation:
221 
222 Everytime one answer is added, the javascript clones exactly the same row above. Therefore we have to delete the text
223 and scale before write.
224 
225 - Observation:
226 
227 Can't store the value "0"
228 
229 - Observation:
230 
231 Editing the question answers. If we delete one answer with "-" button. In the table "svy_category" this answer remains available.
232 this answer is perfectly deleted in "svy_variable" table.
233 
234  select * from svy_question;
235  +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
236  | question_id | questiontype_fi | obj_fi | owner_fi | title | description | author | obligatory | complete | created | original_id | tstamp | questiontext | label |
237  +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
238  | 50 | 2 | 277 | 6 | My first question | NULL | root user | 1 | 1 | 1475171583 | NULL | 1475174823 | This is my question | NULL |
239  | 51 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475172649 | NULL | 0 | NULL | NULL |
240  | 52 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174096 | NULL | 0 | NULL | NULL |
241  | 53 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174194 | NULL | 0 | NULL | NULL |
242  | 54 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475174292 | NULL | 0 | NULL | NULL |
243  | 55 | 2 | 277 | 6 | NULL | NULL | root user | 1 | 0 | 1475175261 | NULL | 0 | NULL | NULL |
244  +-------------+-----------------+--------+----------+-------------------+-------------+-----------+------------+----------+------------+-------------+------------+---------------------+-------+
245  6 rows in set (0.00 sec)
246 
247 
248 **In the Questions page (Drag and drop section)**
249 
250 Only the GUI files are affected:
251 - Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestionGUI.php
252 - Modules/SurveyQuestionPool/classes/class.SurveyMultipleChoiceQuestionGUI.php
253 - Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestionGUI.php
254 
255 Not affected:
256 - Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestion.php
257 - Modules/SurveyQuestionPool/classes/class.SurveyMultipleChoiceQuestion.php
258 - Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php
259 
260 Here que can create pages, add from pool etc...
261 
262 - Problem/Observation:
263 
264 Here we are passing to the template, the scale -1. Therefore all the radio buttons, checkboxes will have the scale value as scale -1
265 Also if we need store 0 values this if statement is not valid.
266 
267  $template->setVariable("VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i);
268 
269 functions affected:
270 
271 - getParsedAnswers
272 - getWorkingForm (horizontal,vertical and combobox options)
273 
274 
275 ## POSSIBLE CONFLICTS
276 In this Services I have seen "svy_variable"
277 - Services/Database/test/Implementations/data
278 - Services/Database/test/Implementations/data
279 - Services/LoadTest/data/usr_1000
280 
281 
282 ## DATABASE TABLES
283 
284 
285 
286 #### svy_qtype
287 
288 Stores the question types: SingleChoice / MultipleChoice / Matrix / Metric
289 
290 
291 #### svy_category
292 
293 Stores all the answers saved by the user, even if this answers were deleted at any moment.
294 
295 ####svy_answer
296 
297 Stores the answers, those that the user chooses when he takes the survey.
298 
299 
300 ## EXAMPLE: Table comparation
301 
302 For the "question_fi" 50
303 
304 We have 2 scales, 11 and 22:
305 
306  select * from svy_variable;
307  +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
308  | variable_id | category_fi | question_fi | value1 | value2 | sequence | tstamp | other | scale |
309  +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
310  | 291 | 123 | 50 | 2 | NULL | 1 | 1475174823 | 0 | 22 |
311  | 290 | 122 | 50 | 1 | NULL | 0 | 1475174823 | 0 | 11 |
312  +-------------+-------------+-------------+--------+--------+----------+------------+-------+-------+
313  2 rows in set (0.00 sec)
314 
315 User answered but the scale is saved as value 10: (scale -1)
316 
317  select * from svy_answer;
318  +-----------+-----------+-------------+-------+------------+----------+------------+
319  | answer_id | active_fi | question_fi | value | textanswer | rowvalue | tstamp |
320  +-----------+-----------+-------------+-------+------------+----------+------------+
321  | 54 | 3 | 50 | 10 | NULL | 0 | 1475178660 |
322  +-----------+-----------+-------------+-------+------------+----------+------------+
323  1 row in set (0.00 sec)
324 
325 
326 
327 ##Tables documentation.
328 
329 * table svy_qtype
330  * questiontype_id: sequence value -> svy_qtype_seq (PK)
331  * type_tag
332  * plugin: always 0??
333 
334 
335 * table svy_question (What is the difference between tstamp and created?)
336  * question_id: sequence value -> svy_question_seq (PK)
337  * questiontype_fi: question type -> svy_qtype
338  * obj_fi: survey or survey pool object -> object_data (MUL)
339  * owner_fi: author user -> usr_data and object_data (MUL)
340  * title: question text (MUL)
341  * description:
342  * author:
343  * obligatory:
344  * complete: 1 or 0 depending if the user saved any data
345  * created:
346  * original_id:
347  * tstamp:
348  * questiontext:
349  * label:
350  INSERT: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveToDb
351  UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveToDb
352  DELETE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - delete
353  UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - delete
354  UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - _changeOriginalId
355  INSERT: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - createNewQuestion
356  UPDATE: Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php - saveCompletionStatus
357  UPDATE: Modules/Survey/classes/class.ilObjSurvey.php - setObligatoryStates
358  UPDATE: Modules/SurveyQuestionPool/classes/class.ilObjSurveyQuestionPool.php - setObligatoryStates
359 
360 * table svy_category
361  * category_id: sequence value -> svy_category_seq (PK)
362  * title: answer text
363  * defaultvalue: is set to "1" for categories predefined by the system? or for user defined phrases
364  * owner_fi: (MUL)
365  * neutral:
366  * tstamp:
367 
368 
369 * table svy_variable
370  * variable_id: sequence value -> svy_variable_seq (PK)
371  * category_fi: general answer option -> svy_category (MUL)
372  * question_fi: question -> svy_question (MUL)
373  * value1: for metric q: min value
374  * value2: for metric q: max value
375  * sequence: order of the options in the question presentation
376  * other:
377  * scale: scale value (positives or NULL. Here the scale have the real value entered, not scale -1 )
378 
379 * table svy_phrase
380  * phrase_id: sequence value -> svy_phrase_seq (PK)
381  * title: phrase text
382  * defaultvalue:
383  * owner_fi: (MUL)
384  * tstamp:
385 
386 
387 * table svy_phrase_cat
388  * phrase_category_id: sequence value -> svy_phrase_cat_seq (PK)
389  * phrase_fi -> phrase in svy_phrase (MUL)
390  * category_fi -> general answer option in svy_category (MUL)
391  * sequence: order of the options in the question presentation
392  * other:
393  * scale: always NULL?, editing provides only disabled input fields
394 
395 * table svy_svy
396  * survey_id: sequence value -> svy_svy_seq (PK)
397  * obj_fi: general object -> object_data (MUL)
398  * author
399  * introduction: (MUL)
400  * outro
401  * status
402  * evaluation_access
403  * invitation
404  * invitation_mode
405  * complete
406  * anonymize
407  * show_question_titles
408  * tstamp
409  * created
410  * mailnotification
411  * startdate
412  * enddate
413  * mailaddresses
414  * mailparticipantdata
415  * template_id
416  * pool_usage
417  * mode_360
418  * mode_360_self_eval
419  * mode_360_self_rate
420  * mode_360_self_appr
421  * mode_360_results
422  * mode_360_skill_service
423  * reminder_status
424  * reminder_start
425  * reminder_end
426  * reminder_frequency
427  * reminder_target
428  * tutor_ntf_status
429  * tutor_ntf_reci
430  * tutor_ntf_target
431  * reminder_last_sent
432  * own_results_view
433  * own_results_mail
434  * confirmation_mail
435  * anon_user_list
436  * reminder_tmpl
437 
438 *table svy_settings
439  * settings_id: sequence value -> svy_settings_seq (PK)
440  * usr_id
441  * keyword
442  * title
443  * value
444 
445 * table svy_svy_qst
446  * survey_question_id: sequence value -> svy_svy_qst_seq (PK)
447  * survey_fi: survey -> svy_svy (MUL)
448  * question_fi: question -> svy_question
449  * sequence: ordering of the questions in the survey (increments +1 normally through question blocks)
450  * heading
451  * tstamp
452 
453 
454 * table svy_qst_oblig
455  * question_obligatory_id -> sequence value -> sv_qst_oblig_seq (PK)
456  * survey_fi: survey -> svy_svy (MUL)
457  * question_fi: question -> svy_question
458  * obligatory: 1 for true
459  *tstamp
460 
461 * table svy_qblk
462  * questionblock_id: sequence value -> sv_qblk_seq (PK)
463  * title: block title
464  * show_questiontext: enables to show/hide question texts for questions of the block
465  * owner_fi: (MUL)
466  * tstamp:
467  * show_blocktitle: show/hide title of the block in presentation
468 
469 * table svy_qblk_qst
470  * qblk_qst_id: sequence value -> sv_gblk_qst_seq (PK)
471  * survey_fi: survey -> svy_svy
472  * question_fi: question -> svy_question (could have pointed to svy_svy_qst instead, but does not do)
473  * question_block_fi: block -> svy_qblk
474 
475 * table svy_relation (fixed set of relations, should be moved from table to class constants)
476  * relation_id: sequence value -> sv_relation_seq (PK)
477  * longname: e.g. less
478  * shortname: e.g. <
479  * tstamp:
480 
481 * table svy_constraint
482  * constraint_id: sequence value -> svy_constraint_seq (PK)
483  * question_fi: "source" question -> svy_question (MUL)
484  * relation_fi: relation -> svy_relation (MUL)
485  * value: scale value - 1 !?
486  * conjunction: or/and (but why on this level?)
487 
488 * table svy_qst_constraint
489  * question_constraint_id: sequence value -> svy_qst_constraint_seq (PK)
490  * survey_fi: survey -> svy_svy (MUL)
491  * question_fi: "target" question -> svy_question (MUL)
492  * constraint_fi: constraint definition -> svy_constraint (MUL)
493 
494 * table svy_finished
495  * finished_id: sequence value -> svy_finished_seq (PK)
496  * survey_fi: survey -> svy_svy (MUL)
497  * user_fi: user -> usr_data (and object_data)(MUL)
498  * anonymous_id: (MUL)
499  * state: 1 if finished? 0 otherwise?
500  * lastpage:
501  * appr_id:
502 
503 *table svy_material
504  * material_id: sequence value -> svy_material_seq (PK)
505  * question_fi: question -> svy_question (MUL)
506  * internal_link:
507  * import_id:
508  * material_title:
509  * tstamp:
510  * text_material:
511  * external_link:
512  * file material:
513  * material_type:
514 
515 * table svy_qst_metric
516  * question_fi: question -> sv_question (PK)
517  * subtype: default 3
518 
519 * table svy_times
520  * id: sequence value -> svy_times_seq (PK)
521  * finished_fi: survey run -> svy_finished (MUL)
522  * first_question: first question id of page/block -> svy_question (does not seem to point to svy_svy_qst)
523  * entered_page: timestamp when page has been rendered
524  * left_page: timestamp when answers of page have been saved
525 
526 * table svy_answer
527  * answer_id: sequence value -> svy_answer_seq (PK)
528  * active_fi: survey run -> svy_finished
529  * question_fi: question -> svy_question (does not point to svy_svy_qst)
530  * value: scale value of corresponding "variable" -1?
531  * textanswer:
532  * rowvalue:
533  * tstamp:
534 
535 * table svy_qst_sc
536  * question_fi: question -> svy_question (PK)
537  * orientation: horizontal, vertial or combobox
538 
539 * table svy_qst_mc
540  * question_fi: question -> svy_question (PK)
541  * orientation: horizontal, vertial
542  * nr_min_answers:
543  * nr_max_answers:
544 
545 * table svy_qst_matrix
546  * question_fi: question -> svy_question (PK)
547  * subtype
548  * column_separators
549  * row_separators
550  * neutral_column_separator
551  * column_placeholders
552  * legend
553  * singleline_row_caption
554  * repeat_column_header
555  * column_header_position
556  * random_rows
557  * column_order
558  * column_images
559  * row_images
560  * bipolar_adjective1
561  * bipolar_adjective2
562  * layout
563  * tstamp
564 
565 *table svy_qst_matrix_rows
566  * id_svy_qst_matrixrows: sequence value -> svy_qst_matrix_rows_seq (PK)
567  * title
568  * sequence
569  * question_fi: question -> svy_question (MUL)
570  * other
571  * label
572 
573 * table svy_qpl
574  * id_questionpool: sequence value -> svy_qpl_seq (PK)
575  * obj_fi: (MUL)
576  * isonline:
577  * tstamp
578 
579 * table svy_inv_usr
580  * invited_user_id: sequence value -> svy_inv_usr_seq (PK)
581  * survey_fi: survey -> svy_svy (MUL)
582  * user_fi: user -> usr_data (MUL)
583  * tstamp
584 
585 * table svy_qst_text
586  * question_fi: question -> svy_question (PK)
587  * maxchars:
588  * width:
589  * height:
590 
591 * table svy_anonymous:
592  * anonymous_id: sequence value -> svy_anonymous_seq (PK)
593  * survey_key:
594  * survey_fi: survey -> svy_svy
595  * user_key:
596  * tstamp:
597  * externaldata:
598  * sent:
599 
600 * table svy_360_appr
601  * obj_id:
602  * user_id:
603  * has_closed:
604 
605 *table svy_360_rater
606  * obj_id
607  * appr_id
608  * user_id
609  * anonymous_id
610  * mail_sent
611 
612 *table svy_quest_skill
613  * q_id:
614  * survey_id
615  * base_skill_id
616  * tref_id
617 
618 *table svy_skill_threshold
619  * survey_id:
620  * base_skill_id:
621  * tref_id:
622  * level_id:
623  * threshold
File written to
Add some data
Sum of both Ranges is
Definition: 03formulas.php:77
$errors general
Prepares and displays settings form.
Definition: imgupload.php:50
for( $i=1;$i< 200;$i++)
Holds the type of the event to listen for.
Definition: 04printing.php:58
user()
Definition: user.php:4
$errors fields
Definition: imgupload.php:51
Class SurveyCategories.
exit
Definition: dev.txt.php:1
The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix quest...
Basic class for all survey question types.
e($cmd)
Definition: flush.php:14
Create styles array
The data for the language used.
Remove unnecessary rows
settings()
Definition: settings.php:2
Set document properties
Set thin black border outline around column
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
Definition: bootstrap.php:27
Survey category class.