-
Notifications
You must be signed in to change notification settings - Fork 987
/
surveySettings.php
153 lines (144 loc) · 7.11 KB
/
surveySettings.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
<?php
/* @var SurveysGroupsController $this */
/* @var SurveysGroups $model */
/* @var array $jsData */
/* @var SurveysGroupsettings $oSurvey */
/* @var string $partial */
/* @var array $users */
/* @var array $aDateFormatDetails */
$optionsOnOff = [
'Y' => gT('On', 'unescaped'),
'N' => gT('Off', 'unescaped'),
];
Yii::app()->getClientScript()->registerScript(
'GlobalSurveySettings',
"window.GlobalSideMenuData = " . json_encode($jsData) . ";",
LSYii_ClientScript::POS_BEGIN
);
?>
<div class="position-relative">
<div class="d-flex flex-wrap flex-lg-nowrap" id="surveySettingsForThisGroup">
<div id="global-sidebar-container">
<global-sidemenu/>
</div>
<div id="pjax-content" class="tab-content col-lg-10 flex-lg-shrink-1 ps-4">
<?php if ($model->hasPermission('surveysettings', 'update')) : ?>
<div class="row">
<div class="col-12">
<?php
$this->widget('ext.AlertWidget.AlertWidget', [
'text' => gT('All changes of survey group settings will have immediate effect on all related surveys that use inherited values.'),
'type' => 'info',
'htmlOptions' => ['class' => 'controls']
]);
?>
</div>
</div>
<?php endif; ?>
<?php echo CHtml::form(["admin/surveysgroups/sa/surveysettings/id/" . $oSurvey->gsid . "/#surveySettingsGeneral"], 'post', ['id' => 'survey-settings-options-form']); ?>
<div class="tab-content">
<?php if ($partial === '_generaloptions_panel') { ?>
<div id="surveySettingsGeneral" class="row">
<?php $this->renderPartial(
'survey/subview/accordion/_generaloptions_panel',
[
'oSurvey' => $oSurvey,
'oSurveyOptions' => $oSurvey->oOptionLabels,
'bShowInherited' => $oSurvey->showInherited,
'optionsOnOff' => $optionsOnOff,
'bShowAllOptions' => false,
'users' => $users,
]
); ?>
</div>
<?php } elseif ($partial === '_presentation_panel') { ?>
<div id="surveySettingsPresentation">
<?php $this->renderPartial(
'survey/subview/accordion/_presentation_panel',
[
'oSurvey' => $oSurvey,
'oSurveyOptions' => $oSurvey->oOptionLabels,
'bShowInherited' => $oSurvey->showInherited,
'optionsOnOff' => $optionsOnOff
]
); ?>
</div>
<?php } elseif ($partial === '_tokens_panel') { ?>
<div id="surveySettingsParticipants">
<?php $this->renderPartial(
'survey/subview/accordion/_tokens_panel',
[
'oSurvey' => $oSurvey,
'oSurveyOptions' => $oSurvey->oOptionLabels,
'bShowInherited' => $oSurvey->showInherited,
'optionsOnOff' => $optionsOnOff
]
); ?>
</div>
<?php } elseif ($partial === '_notification_panel') { ?>
<div id="surveySettingsNotification">
<?php $this->renderPartial(
'survey/subview/accordion/_notification_panel',
[
'oSurvey' => $oSurvey,
'oSurveyOptions' => $oSurvey->oOptionLabels,
'bShowInherited' => $oSurvey->showInherited,
'optionsOnOff' => $optionsOnOff,
'bShowAllOptions' => false,
]
); ?>
</div>
<?php } elseif ($partial === '_publication_panel') { ?>
<div id="surveySettingsPublication">
<?php $this->renderPartial(
'survey/subview/accordion/_publication_panel',
[
'oSurvey' => $oSurvey,
'oSurveyOptions' => $oSurvey->oOptionLabels,
'bShowInherited' => $oSurvey->showInherited,
'optionsOnOff' => $optionsOnOff,
'dateformatdetails' => $aDateFormatDetails,
'bShowAllOptions' => false,
]
); ?>
</div>
<?php } ?>
<div class="d-none">
<?php echo TbHtml::submitButton('Save', ['class' => 'btn btn-primary col-lg-2 col-md-4', "id" => "survey-settings-options-form"]); ?>
</div>
</div>
<?php echo CHtml::endForm() ?>
</div>
</div>
<?php
Yii::app()->getClientScript()->registerScript(
"editLocalSettings_submit",
"
$('#surveySettings a').click(function (e) {
window.location.hash = $(this).attr('href');
e.preventDefault();
$('#survey-settings-options-form').attr('action',' " . Yii::app()->getController()->createUrl('/admin/surveysgroups/sa/surveysettings/id/' . $oSurvey->gsid) . "'+window.location.hash);
$(this).tab('show');
});
$('.text-option-inherit').on('change', function(e){
var newValue = $(this).find('.btn-check:checked').val();
var parent = $(this).parent().parent();
var inheritValue = parent.find('.inherit-edit').data('inherit-value');
var savedValue = parent.find('.inherit-edit').data('saved-value');
if (newValue == 'Y'){
parent.find('.inherit-edit').addClass('d-none').removeClass('d-block').val(inheritValue);
parent.find('.inherit-readonly').addClass('d-block').removeClass('d-none');
} else {
var inputValue = (savedValue === inheritValue) ? \"\" : savedValue;
parent.find('.inherit-edit').addClass('d-block').removeClass('d-none').val(inputValue);
parent.find('.inherit-readonly').addClass('d-none').removeClass('d-block');
}
});
if(window.location.hash){
$('#surveySettings').find('a[href='+window.location.hash+']').trigger('click');
}
$('#save-form-button, #save-and-close-form-button').attr('data-form-id', 'survey-settings-options-form');",
LSYii_ClientScript::POS_POSTSCRIPT
);
?>
</div>