You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

input.part copy 2.php 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php $row_id = $this->view->survey_tag.'_row_'.$index; ?>
  2. <?php $input_id = $this->view->survey_tag.'_answer_'.$index; ?>
  3. <div class="form-group margin-top-20 margin-bottom-20 <?php echo $item['grid']; ?>" id="<?php echo $row_id; ?>">
  4. <?php if(isset($item['question'])&&trim($item['question'])!=''): ?><label class="label-main-question"><?php echo $item['question']; ?></label><?php endif; ?>
  5. <input type="hidden" name="data[<?php echo $index; ?>][group]" value="<?php echo $group; ?>">
  6. <input type="hidden" name="data[<?php echo $index; ?>][type]" value="<?php echo $type; ?>">
  7. <input type="hidden" name="data[<?php echo $index; ?>][question]" value="<?php echo $item['question']; ?>">
  8. <?php switch($type): case 'radio': ?>
  9. <?php case 'checkbox': ?>
  10. <input type="hidden" name="data[<?php echo $index; ?>][answer][value]" value="<?php echo isset($item['default']) ? $item['default'] : ''; ?>">
  11. <?php foreach($item['answer'] as $answer_index => $answer): ?>
  12. <div class="form-check form-check-inline">
  13. <?php $checked = isset($item['default'])&&($answer['value']==$item['default']) ? 'checked' : ''; ?>
  14. <input class="form-check-input <?php echo $input_id; ?> <?php echo isset($item['extra_class']) ? $item['extra_class'] : ''; ?>" type="<?php echo $type; ?>" id="id_<?php echo $input_id; ?>_<?php echo $answer_index; ?>" name="data[<?php echo $index; ?>][answer][value]" value="<?php echo $answer['value']; ?>" <?php echo $checked; ?> <?php echo isset($item['extra']) ? $item['extra'] : ''; ?>>
  15. <label class="form-check-label" for="id_<?php echo $input_id; ?>"><?php echo $answer['label']; ?></label>
  16. </div>
  17. <?php endforeach; ?>
  18. <?php break;?>
  19. <?php case 'textarea': ?>
  20. <textarea name="data[<?php echo $index; ?>][answer]" class="form-control <?php echo $input_id; ?> <?php echo isset($item['extra_class']) ? $item['extra_class'] : ''; ?>" rows="<?php echo (isset($item['rows'])&&(int)$item['rows']>1) ? $item['rows'] : 1; ?>" id="id_<?php echo $input_id; ?>" <?php echo isset($item['extra']) ? $item['extra'] : ''; ?>><?php echo isset($item['default']) ? $item['default'] : ''; ?></textarea>
  21. <?php if(isset($item['extra_text'])): ?>
  22. <p class="text-muted"><small><?php echo $item['extra_text']; ?></small></p>
  23. <?php endif; ?>
  24. <?php break; ?>
  25. <?php case 'inputlist': ?>
  26. <?php foreach($item['list'] as $item_list_index => $list_item): ?>
  27. <div class="margin-bottom-10 margin-left-10">
  28. <div><?php echo $list_item['label']; ?></div>
  29. <input type="hidden" name="data[<?php echo $index; ?>][list][<?php echo $item_list_index; ?>][label]" value="<?php echo $list_item['label']; ?>">
  30. <?php if($list_item['type'] == 'radio'): ?>
  31. <input type="hidden" name="data[<?php echo $index; ?>][list][<?php echo $item_list_index; ?>][answer]" value="">
  32. <?php foreach($list_item['answer'] as $value_radio_answer): ?>
  33. <div class="form-check form-check-inline">
  34. <input class="form-check-input <?php echo $list_item['class']; ?>" type="radio" name="data[<?php echo $index; ?>][list][<?php echo $item_list_index; ?>][answer]" value="<?php echo $value_radio_answer['value']; ?>" <?php echo isset($list_item['extra']) ? $list_item['extra'] : ''; ?>>
  35. <label class="form-check-label"><?php echo $value_radio_answer['label']; ?></label>
  36. </div>
  37. <?php endforeach; ?>
  38. <?php elseif ($list_item['type'] == 'textarea'): ?>
  39. <textarea name="data[<?php echo $index; ?>][list][<?php echo $item_list_index; ?>][answer]" class="form-control <?php echo $list_item['class']; ?>" <?php echo $list_item['extra']; ?> rows="<?php echo (isset($list_item['rows'])&&(int)$list_item['rows']>1) ? $list_item['rows'] : 1; ?>"></textarea>
  40. <?php else: ?>
  41. <input type="<?php echo $list_item['type']; ?>" name="data[<?php echo $index; ?>][list][<?php echo $item_list_index; ?>][answer]" class="form-control <?php echo $list_item['class']; ?>" <?php echo $list_item['extra']; ?>>
  42. <?php endif; ?>
  43. </div>
  44. <?php endforeach; ?>
  45. <?php break;?>
  46. <?php case 'file': ?>
  47. <?php if (isset($item['number']) && (int)$item['number']>0): ?>
  48. <?php for($i=1; $i<=$item['number']; $i++): ?>
  49. <?php $col = isset($item['file_grid'][$i-1]) ? $item['file_grid'][$i-1] : 'col-lg-12'; ?>
  50. <?php echo $this->partial('Survey/input-file', ['input_id'=>$input_id.'_'.$i, 'col'=>$col, 'extra_class'=>isset($item['extra_class']) ? $item['extra_class'] : '', 'required'=>isset($item['required']) ? $item['required'] : 0]); ?>
  51. <?php endfor; ?>
  52. <?php if(isset($item['extra_text'])): ?>
  53. <p class="text-muted"><small><?php echo $item['extra_text']; ?></small></p>
  54. <?php endif; ?>
  55. <?php endif; ?>
  56. <?php break;?>
  57. <?php case 'image': ?>
  58. <img src="/public_files/survey/<?php echo $item['filename']; ?>" <?php echo $item['attributes']; ?>>
  59. <?php break; ?>
  60. <?php default: ?>
  61. <input type="<?php echo $type; ?>" value="<?php echo isset($item['default']) ? $item['default'] : ''; ?>" name="data[<?php echo $index; ?>][answer]" id="id_<?php echo $input_id; ?>" class="form-control <?php echo $input_id; ?> <?php echo isset($item['extra_class']) ? $item['extra_class'] : ''; ?>" <?php echo isset($item['extra']) ? $item['extra'] : ''; ?>>
  62. <?php if(isset($item['extra_text'])): ?>
  63. <p class="text-muted"><small><?php echo $item['extra_text']; ?></small></p>
  64. <?php endif; ?>
  65. <?php endswitch;?>
  66. </div>