-
Notifications
You must be signed in to change notification settings - Fork 988
/
Question.php
710 lines (675 loc) · 29.9 KB
/
Question.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
/*
* LimeSurvey
* Copyright (C) 2013 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* Files Purpose: lots of common functions
*/
class Question extends LSActiveRecord
{
/**
* Returns the static model of Settings table
*
* @static
* @access public
* @param string $class
* @return CActiveRecord
*/
public static function model($class = __CLASS__)
{
return parent::model($class);
}
/**
* Returns the setting's table name to be used by the model
*
* @access public
* @return string
*/
public function tableName()
{
return '{{questions}}';
}
/**
* Returns the primary key of this table
*
* @access public
* @return string
*/
public function primaryKey()
{
return array('qid', 'language');
}
/**
* Defines the relations for this model
*
* @access public
* @return array
*/
public function relations()
{
$alias = $this->getTableAlias();
return array(
'groups' => array(self::HAS_ONE, 'QuestionGroup', '', 'on' => "$alias.gid = groups.gid AND $alias.language = groups.language"),
'parents' => array(self::HAS_ONE, 'Question', '', 'on' => "$alias.parent_qid = parents.qid"),
'subquestions' => array(self::HAS_MANY, 'Question', 'parent_qid', 'on' => "$alias.language = subquestions.language")
);
}
/**
* Returns this model's validation rules
*
*/
public function rules()
{
$aRules= array(
array('title','required','on' => 'update, insert'),// 140207 : Before was commented, put only on update/insert ?
array('title','length', 'min' => 1, 'max'=>20,'on' => 'update, insert'),
array('qid', 'numerical','integerOnly'=>true),
array('qid', 'unique', 'criteria'=>array(
'condition'=>'language=:language',
'params'=>array(':language'=>$this->language)
),
'message'=>'{attribute} "{value}" is already in use.'),
array('language','length', 'min' => 2, 'max'=>20),// in array languages ?
array('title,question,help','LSYii_Validators'),
array('other', 'in','range'=>array('Y','N'), 'allowEmpty'=>true),
array('mandatory', 'in','range'=>array('Y','N'), 'allowEmpty'=>true),
array('question_order','numerical', 'integerOnly'=>true,'allowEmpty'=>true),
array('scale_id','numerical', 'integerOnly'=>true,'allowEmpty'=>true),
array('same_default','numerical', 'integerOnly'=>true,'allowEmpty'=>true),
);
if($this->parent_qid)// Allways enforce unicity on Sub question code (DB issue).
{
$aRules[]=array('title', 'unique', 'caseSensitive'=>false, 'criteria'=>array(
'condition' => 'language=:language AND sid=:sid AND parent_qid=:parent_qid and scale_id=:scale_id',
'params' => array(
':language' => $this->language,
':sid' => $this->sid,
':parent_qid' => $this->parent_qid,
':scale_id' => $this->scale_id
)
),
'message' => gT('Subquestion codes must be unique.'));
// Disallow other title if question allow other
$oParentQuestion=Question::model()->findByPk(array("qid"=>$this->parent_qid,'language'=>$this->language));
if($oParentQuestion->other=="Y")
$aRules[]= array('title', 'compare','compareValue'=>'other','operator'=>'!=', 'message'=> sprintf(gT("'%s' can not be used if the 'Other' option for this question is activated."),"other"), 'except' => 'archiveimport');
}
else
{
// Disallow other if sub question have 'other' for title
$oSubquestionOther=Question::model()->find("parent_qid=:parent_qid and title='other'",array("parent_qid"=>$this->qid));
if($oSubquestionOther)
$aRules[]= array('other', 'compare','compareValue'=>'Y','operator'=>'!=', 'message'=> sprintf(gT("'%s' can not be used if the 'Other' option for this question is activated."),'other'), 'except' => 'archiveimport' );
}
if(!$this->isNewRecord)
{
$oActualValue=Question::model()->findByPk(array("qid"=>$this->qid,'language'=>$this->language));
if($oActualValue && $oActualValue->title==$this->title)
{
return $aRules; // We don't change title, then don't put rules on title
}
}
if(!$this->parent_qid)// 0 or empty
{
$aRules[]=array('title', 'unique', 'caseSensitive'=>true, 'criteria'=>array(
'condition' => 'language=:language AND sid=:sid AND parent_qid=0',
'params' => array(
':language' => $this->language,
':sid' => $this->sid
)
),
'message' => gT('Question codes must be unique.'), 'except' => 'archiveimport');
$aRules[]= array('title', 'match', 'pattern' => '/^[a-z,A-Z][[:alnum:]]*$/', 'message' => gT('Question codes must start with a letter and may only contain alphanumeric characters.'), 'except' => 'archiveimport');
}
else
{
$aRules[]= array('title', 'match', 'pattern' => '/^[[:alnum:]]*$/', 'message' => gT('Subquestion codes may only contain alphanumeric characters.'), 'except' => 'archiveimport');
}
return $aRules;
}
/**
* Rewrites sort order for questions in a group
*
* @static
* @access public
* @param int $gid
* @param int $surveyid
* @return void
*/
public static function updateSortOrder($gid, $surveyid)
{
$questions = self::model()->findAllByAttributes(array('gid' => $gid, 'sid' => $surveyid, 'language' => Survey::model()->findByPk($surveyid)->language), array('order'=>'question_order') );
$p = 0;
foreach ($questions as $question)
{
$question->question_order = $p;
$question->save();
$p++;
}
}
/**
* Fixe sort order for questions in a group
*
* @static
* @access public
* @param int $gid
* @param int $surveyid
* @return void
*/
function updateQuestionOrder($gid,$language,$position=0)
{
$data=Yii::app()->db->createCommand()->select('qid')
->where(array('and','gid=:gid','language=:language', 'parent_qid=0'))
->order('question_order, title ASC')
->from('{{questions}}')
->bindParam(':gid', $gid, PDO::PARAM_INT)
->bindParam(':language', $language, PDO::PARAM_STR)
->query();
$position = intval($position);
foreach($data->readAll() as $row)
{
Yii::app()->db->createCommand()->update($this->tableName(),array('question_order' => $position),'qid='.$row['qid']);
$position++;
}
}
/**
* This function returns an array of the advanced attributes for the particular question
* including their values set in the database
*
* @access public
* @param int $iQuestionID The question ID - if 0 then all settings will use the default value
* @param string $sQuestionType The question type
* @param int $iSurveyID
* @param string $sLanguage If you give a language then only the attributes for that language are returned
* @return array
*/
public function getAdvancedSettingsWithValues($iQuestionID, $sQuestionType, $iSurveyID, $sLanguage=null)
{
if (is_null($sLanguage))
{
$aLanguages = array_merge(array(Survey::model()->findByPk($iSurveyID)->language), Survey::model()->findByPk($iSurveyID)->additionalLanguages);
}
else
{
$aLanguages = array($sLanguage);
}
if ($iQuestionID)
{
$oAttributeValues = QuestionAttribute::model()->findAll("qid=:qid",array('qid'=>$iQuestionID));
$aAttributeValues=array();
foreach($oAttributeValues as $oAttributeValue)
{
if($oAttributeValue->language){
$aAttributeValues[$oAttributeValue->attribute][$oAttributeValue->language]=$oAttributeValue->value;
}else{
$aAttributeValues[$oAttributeValue->attribute]=$oAttributeValue->value;
}
}
}
$aAttributeNames = questionAttributes();
$aAttributeNames = $aAttributeNames[$sQuestionType];
uasort($aAttributeNames, 'categorySort');
foreach ($aAttributeNames as $iKey => $aAttribute)
{
if ($aAttribute['i18n'] == false)
{
if (isset($aAttributeValues[$aAttribute['name']]))
{
$aAttributeNames[$iKey]['value'] = $aAttributeValues[$aAttribute['name']];
}
else
{
$aAttributeNames[$iKey]['value'] = $aAttribute['default'];
}
}
else
{
foreach ($aLanguages as $sLanguage)
{
if (isset($aAttributeValues[$aAttribute['name']][$sLanguage]))
{
$aAttributeNames[$iKey][$sLanguage]['value'] = $aAttributeValues[$aAttribute['name']][$sLanguage];
}
else
{
$aAttributeNames[$iKey][$sLanguage]['value'] = $aAttribute['default'];
}
}
}
}
return $aAttributeNames;
}
function getQuestionById($qid)
{
return Yii::app()->db->createCommand()
->select()
->from(self::tableName())
->where('qid=:qid')
->bindParam(":qid", $qid, PDO::PARAM_INT)
->queryRow();
}
function getQuestions($sid, $gid, $language)
{
return Yii::app()->db->createCommand()
->select()
->from(self::tableName())
->where(array('and', 'sid=:sid', 'gid=:gid', 'language=:language', 'parent_qid=0'))
->order('question_order asc')
->bindParam(":sid", $sid, PDO::PARAM_INT)
->bindParam(":gid", $gid, PDO::PARAM_INT)
->bindParam(":language", $language, PDO::PARAM_STR)
->query();
}
function getSubQuestions($parent_qid)
{
return Yii::app()->db->createCommand()
->select()
->from(self::tableName())
->where('parent_qid=:parent_qid')
->bindParam(":parent_qid", $parent_qid, PDO::PARAM_INT)
->order('question_order asc')
->query();
}
function getQuestionsWithSubQuestions($iSurveyID, $sLanguage, $sCondition = FALSE)
{
$command = Yii::app()->db->createCommand()
->select('{{questions}}.*, q.qid as sqid, q.title as sqtitle, q.question as sqquestion, ' . '{{groups}}.*')
->from($this->tableName())
->leftJoin('{{questions}} q', "q.parent_qid = {{questions}}.qid AND q.language = {{questions}}.language")
->join('{{groups}}', "{{groups}}.gid = {{questions}}.gid AND {{questions}}.language = {{groups}}.language");
$command->where("({{questions}}.sid = '$iSurveyID' AND {{questions}}.language = '$sLanguage' AND {{questions}}.parent_qid = 0)");
if ($sCondition != FALSE)
{
$command->where("({{questions}}.sid = :iSurveyID AND {{questions}}.language = :sLanguage AND {{questions}}.parent_qid = 0) AND {$sCondition}")
->bindParam(":iSurveyID", $iSurveyID, PDO::PARAM_STR)
->bindParam(":sLanguage", $sLanguage, PDO::PARAM_STR);
}
$command->order("{{groups}}.group_order asc, {{questions}}.question_order asc");
return $command->query()->readAll();
}
/**
* Insert an array into the questions table
* Returns false if insertion fails, otherwise the new QID
*
* @param array $data
*/
function insertRecords($data)
{
// This function must be deprecated : don't find a way to have getErrors after (Shnoulle on 131206)
$questions = new self;
foreach ($data as $k => $v){
$questions->$k = $v;
}
try
{
$questions->save();
return $questions->qid;
}
catch(Exception $e)
{
return false;
}
}
public static function deleteAllById($questionsIds)
{
if ( !is_array($questionsIds) )
{
$questionsIds = array($questionsIds);
}
Yii::app()->db->createCommand()->delete(Condition::model()->tableName(), array('in', 'qid', $questionsIds));
Yii::app()->db->createCommand()->delete(QuestionAttribute::model()->tableName(), array('in', 'qid', $questionsIds));
Yii::app()->db->createCommand()->delete(Answer::model()->tableName(), array('in', 'qid', $questionsIds));
Yii::app()->db->createCommand()->delete(Question::model()->tableName(), array('in', 'parent_qid', $questionsIds));
Yii::app()->db->createCommand()->delete(Question::model()->tableName(), array('in', 'qid', $questionsIds));
Yii::app()->db->createCommand()->delete(DefaultValue::model()->tableName(), array('in', 'qid', $questionsIds));
Yii::app()->db->createCommand()->delete(QuotaMember::model()->tableName(), array('in', 'qid', $questionsIds));
}
function getAllRecords($condition, $order=FALSE)
{
$command=Yii::app()->db->createCommand()->select('*')->from($this->tableName())->where($condition);
if ($order != FALSE)
{
$command->order($order);
}
return $command->query();
}
public function getQuestionsForStatistics($fields, $condition, $orderby=FALSE)
{
$command = Yii::app()->db->createCommand()
->select($fields)
->from(self::tableName())
->where($condition);
if ($orderby != FALSE)
{
$command->order($orderby);
}
return $command->queryAll();
}
public function getQuestionList($surveyid, $language)
{
$query = "SELECT questions.*, groups.group_name, groups.group_order"
." FROM {{questions}} as questions, {{groups}} as groups"
." WHERE groups.gid=questions.gid"
." AND groups.language=:language1"
." AND questions.language=:language2"
." AND questions.parent_qid=0"
." AND questions.sid=:sid";
return Yii::app()->db->createCommand($query)->bindParam(":language1", $language, PDO::PARAM_STR)
->bindParam(":language2", $language, PDO::PARAM_STR)
->bindParam(":sid", $surveyid, PDO::PARAM_INT)->queryAll();
}
/**
* Returns the type of subquestions for this question:
* 0: No subquestions,
* 1: Subquestions on 1 scale.
* 2: Subquestions on 2 scales. (Used only by array(texts) and array(numbers) question types)
* @return integer
* @throws CException
*/
public function getHasSubQuestions()
{
$types = self::typeList();
if (isset($types[$this->type]))
{
return $types[$this->type]['subquestions'];
}
throw new CException("Unknown question type: '{$this->type}'");
}
/**
* Returns the type of answers for this question:
* 0: No answers (ie open text question),
* 1: Answers on 1 scale.
* 2: Answers on 2 scales. (Used only by array(dual scale) question type)
* @return integer
* @throws CException
*/
public function getHasAnswerScales()
{
$types = self::typeList();
if (isset($types[$this->type]))
{
return $types[$this->type]['answerscales'] == 1;
}
throw new CException("Unknown question type: '{$this->type}'");
}
/**
* This function contains the question type definitions.
* @return array The question type definitions
*
* Explanation of questiontype array:
*
* description : Question description
* subquestions : 0= Does not support subquestions x=Number of subquestion scales
* answerscales : 0= Does not need answers x=Number of answer scales (usually 1, but e.g. for dual scale question set to 2)
* assessable : 0=Does not support assessment values when editing answerd 1=Support assessment values
*/
public static function typeList()
{
$questionTypes = array(
"1" => array(
'description' => gT("Array dual scale"),
'group' => gT('Arrays'),
'subquestions' => 1,
'assessable' => 1,
'hasdefaultvalues' => 0,
'answerscales' => 2),
"5" => array(
'description' => gT("5 Point Choice"),
'group' => gT("Single choice questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
"A" => array(
'description' => gT("Array (5 Point Choice)"),
'group' => gT('Arrays'),
'subquestions' => 1,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 0),
"B" => array(
'description' => gT("Array (10 Point Choice)"),
'group' => gT('Arrays'),
'subquestions' => 1,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 0),
"C" => array(
'description' => gT("Array (Yes/No/Uncertain)"),
'group' => gT('Arrays'),
'subquestions' => 1,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 0),
"D" => array(
'description' => gT("Date/Time"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"E" => array(
'description' => gT("Array (Increase/Same/Decrease)"),
'group' => gT('Arrays'),
'subquestions' => 1,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 0),
"F" => array(
'description' => gT("Array"),
'group' => gT('Arrays'),
'subquestions' => 1,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 1),
"G" => array(
'description' => gT("Gender"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
"H" => array(
'description' => gT("Array by column"),
'group' => gT('Arrays'),
'hasdefaultvalues' => 0,
'subquestions' => 1,
'assessable' => 1,
'answerscales' => 1),
"I" => array(
'description' => gT("Language Switch"),
'group' => gT("Mask questions"),
'hasdefaultvalues' => 0,
'subquestions' => 0,
'assessable' => 0,
'answerscales' => 0),
"K" => array(
'description' => gT("Multiple Numerical Input"),
'group' => gT("Mask questions"),
'hasdefaultvalues' => 1,
'subquestions' => 1,
'assessable' => 1,
'answerscales' => 0),
"L" => array(
'description' => gT("List (Radio)"),
'group' => gT("Single choice questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 1,
'answerscales' => 1),
"M" => array(
'description' => gT("Multiple choice"),
'group' => gT("Multiple choice questions"),
'subquestions' => 1,
'hasdefaultvalues' => 1,
'assessable' => 1,
'answerscales' => 0),
"N" => array(
'description' => gT("Numerical Input"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"O" => array(
'description' => gT("List with comment"),
'group' => gT("Single choice questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 1,
'answerscales' => 1),
"P" => array(
'description' => gT("Multiple choice with comments"),
'group' => gT("Multiple choice questions"),
'subquestions' => 1,
'hasdefaultvalues' => 1,
'assessable' => 1,
'answerscales' => 0),
"Q" => array(
'description' => gT("Multiple Short Text"),
'group' => gT("Text questions"),
'subquestions' => 1,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"R" => array(
'description' => gT("Ranking"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 1),
"S" => array(
'description' => gT("Short Free Text"),
'group' => gT("Text questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"T" => array(
'description' => gT("Long Free Text"),
'group' => gT("Text questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"U" => array(
'description' => gT("Huge Free Text"),
'group' => gT("Text questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"X" => array(
'description' => gT("Text display"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
"Y" => array(
'description' => gT("Yes/No"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 0,
'answerscales' => 0),
"!" => array(
'description' => gT("List (Dropdown)"),
'group' => gT("Single choice questions"),
'subquestions' => 0,
'hasdefaultvalues' => 1,
'assessable' => 1,
'answerscales' => 1),
":" => array(
'description' => gT("Array (Numbers)"),
'group' => gT('Arrays'),
'subquestions' => 2,
'hasdefaultvalues' => 0,
'assessable' => 1,
'answerscales' => 0),
";" => array(
'description' => gT("Array (Texts)"),
'group' => gT('Arrays'),
'subquestions' => 2,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
"|" => array(
'description' => gT("File upload"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
"*" => array(
'description' => gT("Equation"),
'group' => gT("Mask questions"),
'subquestions' => 0,
'hasdefaultvalues' => 0,
'assessable' => 0,
'answerscales' => 0),
);
/**
* @todo Check if this actually does anything, since the values are arrays.
*/
asort($questionTypes);
return $questionTypes;
}
/**
* This function return the class by question type
* @param string question type
* @return string Question class to be added to the container
*
* Maybe move class in typeList ?
*/
public static function getQuestionClass($sType)
{
switch($sType)
{
case "1": return 'array-flexible-duel-scale';
case '5': return 'choice-5-pt-radio';
case 'A': return 'array-5-pt';
case 'B': return 'array-10-pt';
case 'C': return 'array-yes-uncertain-no';
case 'D': return 'date';
case 'E': return 'array-increase-same-decrease';
case 'F': return 'array-flexible-row';
case 'G': return 'gender';
case 'H': return 'array-flexible-column';
case 'I': return 'language';
case 'K': return 'numeric-multi';
case 'L': return 'list-radio';
case 'M': return 'multiple-opt';
case 'N': return 'numeric';
case 'O': return 'list-with-comment';
case 'P': return 'multiple-opt-comments';
case 'Q': return 'multiple-short-txt';
case 'R': return 'ranking';
case 'S': return 'text-short';
case 'T': return 'text-long';
case 'U': return 'text-huge';
//case 'W': return 'list-dropdown-flexible'; // LIST drop-down (flexible label)
case 'X': return 'boilerplate';
case 'Y': return 'yes-no';
case 'Z': return 'list-radio-flexible';
case '!': return 'list-dropdown';
//case '^': return 'slider'; // SLIDER CONTROL
case ':': return 'array-multi-flexi';
case ";": return 'array-multi-flexi-text';
case "|": return 'upload-files';
case "*": return 'equation';
default: return 'generic_question'; // fallback
};
}
}
?>