3 # Survey Question Pool (Modules/SurveyQuestionPool) 4 * Main question editing/storing
8 * stored in table svy_qtype
9 * Can we
get rid of legacy plugin architecture?
10 * Can we
get of the table completely?
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 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)
27 ### Single Choice Question
30 ### Multiple Choice Question
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
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, ...)
52 * scale (<-
this will be stored in
"Variables")
58 * defaultvalue:
is set to "1" for categories predefined by the system? or
for user defined phrases
62 ## "Variables" (Answer Options of Concrete Questions) 63 * Answer options
for each question
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
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)
77 * Reusable sets of answer options (only
for single choice and matrix questions)
79 * title (of the answer option
set/phrase)
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
88 * scale: always NULL?, editing provides only disabled input
fields 89 * problem: why scale field when always NULL?
93 * Question GUI classes
94 * Save process: save() -> saveForm() -> importEditFormValues() -> question
object saveToDb()
97 # Survey (Modules/Survey) 98 * Represents Survey Repository
Object 99 * Manages question of survey
100 * Stores given answers
105 * obj_fi:
general object -> object_data
108 ## Questions in a survey
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)
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 123 ## Question Block / Page 124 * All questions of a block will be presented on one page
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
130 ## Question Block Questions 131 * Questions of a question block
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
138 * General Idea: Conditional presentation of questions or question blocks (pages) depending on former answers
142 * table svy_relation (fixed
set of relations, should be moved from table
to class constants)
143 * longname,
e.g. less
145 * problem: why storing
this in a table, its
static?
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?)
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
163 ## Survey Run ("Finished") 164 * Stores progress of
user working through a survey
166 * finished_id: autoincrement and pk of
this table
167 * survey_fi: survey -> svy_svy
168 * user_fi:
user -> usr_data (and object_data)
170 * state: 1
if finished? 0 otherwise?
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
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
183 * Given answers by
user during test run, mc question answers may lead
to multiple entries
for one question in a run
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?
191 ====================================
193 ## Current behaviour without patch. 195 ### scales doesn't allow 0 values. And this scales are saved with the scale value - 1 in the table "svy_answer" 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)
205 **In the answers section:**
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".
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.
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.
227 Can
't store the value "0" 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. 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) 248 **In the Questions page (Drag and drop section)** 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 256 - Modules/SurveyQuestionPool/classes/class.SurveySingleChoiceQuestion.php 257 - Modules/SurveyQuestionPool/classes/class.SurveyMultipleChoiceQuestion.php 258 - Modules/SurveyQuestionPool/classes/class.SurveyMatrixQuestion.php 260 Here que can create pages, add from pool etc... 262 - Problem/Observation: 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. 267 $template->setVariable("VALUE_SC", ($cat->scale) ? ($cat->scale - 1) : $i); 272 - getWorkingForm (horizontal,vertical and combobox options) 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 288 Stores the question types: SingleChoice / MultipleChoice / Matrix / Metric 293 Stores all the answers saved by the user, even if this answers were deleted at any moment. 297 Stores the answers, those that the user chooses when he takes the survey. 300 ## EXAMPLE: Table comparation 302 For the "question_fi" 50 304 We have 2 scales, 11 and 22: 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) 315 User answered but the scale is saved as value 10: (scale -1) 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) 327 ##Tables documentation. 330 * questiontype_id: sequence value -> svy_qtype_seq (PK) 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) 344 * complete: 1 or 0 depending if the user saved any data 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 361 * category_id: sequence value -> svy_category_seq (PK) 363 * defaultvalue: is set to "1" for categories predefined by the system? or for user defined phrases 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 377 * scale: scale value (positives or NULL. Here the scale have the real value entered, not scale -1 ) 380 * phrase_id: sequence value -> svy_phrase_seq (PK) 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 393 * scale: always NULL?, editing provides only disabled input fields 396 * survey_id: sequence value -> svy_svy_seq (PK) 397 * obj_fi: general object -> object_data (MUL) 399 * introduction: (MUL) 407 * show_question_titles 414 * mailparticipantdata 422 * mode_360_skill_service 439 * settings_id: sequence value -> svy_settings_seq (PK) 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) 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 462 * questionblock_id: sequence value -> sv_qblk_seq (PK) 464 * show_questiontext: enables to show/hide question texts for questions of the block 467 * show_blocktitle: show/hide title of the block in presentation 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 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 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?) 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) 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? 504 * material_id: sequence value -> svy_material_seq (PK) 505 * question_fi: question -> svy_question (MUL) 515 * table svy_qst_metric 516 * question_fi: question -> sv_question (PK) 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 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? 536 * question_fi: question -> svy_question (PK) 537 * orientation: horizontal, vertial or combobox 540 * question_fi: question -> svy_question (PK) 541 * orientation: horizontal, vertial 545 * table svy_qst_matrix 546 * question_fi: question -> svy_question (PK) 550 * neutral_column_separator 551 * column_placeholders 553 * singleline_row_caption 554 * repeat_column_header 555 * column_header_position 565 *table svy_qst_matrix_rows 566 * id_svy_qst_matrixrows: sequence value -> svy_qst_matrix_rows_seq (PK) 569 * question_fi: question -> svy_question (MUL) 574 * id_questionpool: sequence value -> svy_qpl_seq (PK) 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) 586 * question_fi: question -> svy_question (PK) 591 * table svy_anonymous: 592 * anonymous_id: sequence value -> svy_anonymous_seq (PK) 594 * survey_fi: survey -> svy_svy 612 *table svy_quest_skill 618 *table svy_skill_threshold
SingleChoice survey question.
$errors general
Prepares and displays settings form.
for( $i=1;$i< 200;$i++)
Holds the type of the event to listen for.
The SurveyMatrixQuestion class defines and encapsulates basic methods and attributes for matrix quest...
Basic class for all survey question types.
Create styles array
The data for the language used.
Set thin black border outline around column
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'