-
Notifications
You must be signed in to change notification settings - Fork 988
/
invite.php
182 lines (163 loc) · 9.57 KB
/
invite.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
<?php
/**
* Send email invitations
* @var AdminController $this
* @var Survey $oSurvey
*/
?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<a class="btn btn-default pull-right" href="#" role="button" id="send-invitation-button">
<span class="icon-invite" ></span>
<?php eT("Send invitations");?>
</a>
<h3><?php eT("Send email invitations"); ?></h3>
<div class="row">
<div class="col-lg-12 content-right">
<?php echo PrepareEditorScript(true, $this); ?>
<div>
<?php if ($oSurvey->active != 'Y'): ?>
<div class="jumbotron message-box message-box-error">
<h2 class='text-warning'><?php eT('Warning!'); ?></h2>
<p class="lead text-warning">
<?php eT("This survey is not yet activated and so your participants won't be able to fill out the survey."); ?>
</p>
</div>
<?php endif; ?>
<div>
<?php echo CHtml::form(array("admin/tokens/sa/email/surveyid/{$oSurvey->sid}"), 'post', array('id'=>'sendinvitation', 'name'=>'sendinvitation', 'class'=>'')); ?>
<div class="row">
<div class="col-sm-4">
<?php if (count($tokenids)>0): ?>
<div class='form-group'>
<label class='control-label '><?php eT("Send invitation email to participant ID(s):"); ?></label>
<div class=''>
<?php echo short_implode(", ", "-", (array) $tokenids); ?>
</div>
</div>
<?php endif; ?>
</div>
<div class="col-sm-4">
<div class='form-group'>
<label class='control-label ' for='bypassbademails'><?php eT("Bypass participants with failing email addresses:"); ?></label>
<div class=''>
<?php
$this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => "bypassbademails",
'id'=>"bypassbademails",
'value' => '1',
'onLabel'=>gT('On'),
'offLabel' => gT('Off')));
?>
</div>
</div>
</div>
<div class="col-sm-4">
<div class='form-group'>
<?php echo CHtml::label(
gT("Bypass date control before sending email:"),
'bypassdatecontrol',
array(
'title'=>gt("If some participants have a 'valid from' date set which is in the future, they will not be able to access the survey before that 'valid from' date."),
'unescaped' => 'unescaped',
'class' => 'control-label ')
); ?>
<div class=''>
<?php
$this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => "bypassdatecontrol",
'id'=>"bypassdatecontrol",
'value' => '0',
'onLabel'=>gT('On'),
'offLabel' => gT('Off')));
?>
</div>
</div>
</div>
</div>
<ul class="nav nav-tabs">
<?php
$c = true;
foreach ($oSurvey->allLanguages as $language) {
echo '<li role="presentation"';
if ($c) {
$c=false;
echo ' class="active"';
}
echo '><a data-toggle="tab" href="#'.$language.'">' . getLanguageNameFromCode($language, false);
if ($language == $oSurvey->language) {
echo " (" . gT("Base language") . ")";
}
echo "</a></li>";
}
?>
</ul>
<div class="tab-content">
<?php
$c = true;
foreach ($oSurvey->allLanguages as $language) {
$admin_name = (empty($oSurvey->oOptions->admin))?(Yii::app()->getConfig("siteadminname")):($oSurvey->oOptions->admin);
$admin_email = (empty($oSurvey->oOptions->adminemail))?(Yii::app()->getConfig("siteadminemail")):($oSurvey->oOptions->adminemail);
$fieldsarray["{ADMINNAME}"] = $admin_name;
$fieldsarray["{ADMINEMAIL}"] = $admin_email;
$fieldsarray["{SURVEYNAME}"] = $oSurvey->languagesettings[$language]->surveyls_title;
$fieldsarray["{SURVEYDESCRIPTION}"] = $oSurvey->languagesettings[$language]->surveyls_description;
$fieldsarray["{EXPIRY}"] = $oSurvey->expires;
$subject = Replacefields($oSurvey->languagesettings[$language]->surveyls_email_invite_subj, $fieldsarray, false);
$textarea = Replacefields($oSurvey->languagesettings[$language]->surveyls_email_invite, $fieldsarray, false);
if ($ishtml !== true) {
$textarea = str_replace(array('<x>', '</x>'), array(''), $textarea);
}
?>
<div id="<?php echo $language; ?>" class="tab-pane fade in <?php if ($c){$c=false;echo ' active';}?>">
<div class='form-group'>
<label class='control-label ' for='from_<?php echo $language; ?>'><?php eT("From:"); ?></label>
<div class=''>
<?php echo CHtml::textField("from_{$language}",$admin_name." <".$admin_email.">",array('class' => 'form-control')); ?>
</div>
</div>
<div class='form-group'>
<label class='control-label ' for='subject_<?php echo $language; ?>'><?php eT("Subject:"); ?></label>
<div class=''>
<?php echo CHtml::textField("subject_{$language}",$subject,array('class' => 'form-control')); ?>
</div>
</div>
<div class='form-group'>
<label class='control-label ' for='message_<?php echo $language; ?>'><?php eT("Message:"); ?></label>
<div class=''>
<div class="htmleditor">
<?php echo CHtml::textArea("message_{$language}",$textarea,array('cols'=>80,'rows'=>20, 'class' => 'form-control')); ?>
<?php echo getEditor("email-invitation", "message_$language", "[" . gT("Invitation email:", "js") . "](" . $language . ")", $surveyid, '', '', "tokens"); ?>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
<div class="row">
<div class='form-group'>
<div class=''></div>
<div class=''>
<?php echo CHtml::submitButton(gT("Send Invitations",'unescaped'), array('class'=>'btn btn-default')); ?>
</div>
<?php
echo CHtml::hiddenField('ok','absolutely');
echo CHtml::hiddenField('subaction','invite');
if (!empty($tokenids)) {
echo CHtml::hiddenField('tokenids',implode('|', (array) $tokenids));
}
?>
</div>
</div>
<?php echo CHtml::endForm() ?>
</div>
<?php echo CHtml::endForm() ?>
</div>
</div>
<?php
App()->getClientScript()->registerScript("Tokens:BindInviteView", "
LS.renderBootstrapSwitch();
$('#send-invitation-button').on('click', function(){
$('#sendinvitation').submit();
})
", LSYii_ClientScript::POS_POSTSCRIPT );
?>