/
_editParticipant.php
143 lines (133 loc) · 5.28 KB
/
_editParticipant.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
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<div class="modal-title h4" id="participant_edit_modal"><?php if ($editType == 'add'): eT('Add participant'); else: eT('Edit participant'); endif; ?></div>
</div>
<div class="modal-body edit-participant-modal-body ">
<?php
$form = $this->beginWidget(
'bootstrap.widgets.TbActiveForm',
array(
'id' => 'editPartcipantActiveForm',
'action' => array('admin/participants/sa/editParticipant'),
'htmlOptions' => array('class' => 'form'), // for inset effect
)
);
?>
<input type="hidden" name="oper" value="<?php echo $editType; ?>" />
<?=$form->hiddenField($model, 'participant_id')?>
<?php
echo "<legend>".gT("Basic attributes")."</legend>";
$baseControlGroupHtmlOptions = array(
'labelOptions'=> array('class'=> ''),
'class' => '',
'required' => 'required'
);
?>
<div class='form-group'>
<label class='control-label '>
<?php eT('First name:'); ?>
</label>
<div class=''>
<?=$form->textField($model, 'firstname')?>
</div>
<label class='control-label '>
<?php eT('Last name:'); ?>
</label>
<div class=''>
<?=$form->textField($model, 'lastname')?>
</div>
</div>
<div class='form-group'>
<label class='control-label '>
<?php eT('E-mail:'); ?>
</label>
<div class='0'>
<?=$form->textField($model, 'email')?>
</div>
</div>
<div class='form-group'>
<label class='control-label '><?php eT("Language:"); ?></label>
<div class=''>
<?=$form->dropDownList($model, 'language', $model->languageOptions, ['empty' => gT('Select language...')])?>
</div>
</div>
<div class='form-group'>
<label class='control-label '><?php eT("Blacklist user:"); ?></label>
<div class=''>
<?php $this->widget(
'yiiwheels.widgets.switch.WhSwitch',
array(
'attribute' => 'blacklisted',
'model' => $model,
'htmlOptions'=>array(
'class'=>'bootstrap-switch',
'value' => 'Y'
),
'onLabel'=>gT('Yes'),
'offLabel'=>gT('No'),
/*
'onColor'=> 'warning',
'offColor'=> 'primary'
*/
'onColor'=> 'primary',
'offColor'=> 'warning'
)
);
?>
</div>
</div>
<!-- Change owner -->
<?php if ($model->isOwnerOrSuperAdmin()): ?>
<?php ?>
<div class='form-group'>
<label class='control-label '><?php eT("Owner:"); ?></label>
<div class=''>
<?php
// When we add a new user, owner is default to current user
$selected = ($editType == 'add') ? Yii::app()->user->id : $model->owner_uid;
$listUsers = CHtml::listData($users,'uid','full_name');
echo CHtml::dropDownList('Participant[owner_uid]',$selected,$listUsers,array('id'=>'owner_uid','class'=>'form-control'));
?>
</div>
<div class=''></div>
</div>
<?php endif; ?>
<?php if (count($extraAttributes) > 0): ?>
<legend><?php eT("Custom attributes"); ?></legend>
<?php $i = 0; foreach($extraAttributes as $attribute): $i++; ?>
<!-- Two inputs on each row -->
<?php if ($i % 2 == 0): ?>
<div class='form-group'>
<?php endif; ?>
<?php switch ($attribute['attribute_type']):
// Text box
case 'TB': ?>
<?php $this->renderPartial('/admin/participants/modal_subviews/attributes/textbox', $attribute); ?>
<?php break; ?>
<!-- Drop down -->
<?php case 'DD': ?>
<?php $this->renderPartial('/admin/participants/modal_subviews/attributes/dropdown', $attribute); ?>
<?php break; ?>
<!-- Date -->
<?php case 'DP': ?>
<?php $this->renderPartial('/admin/participants/modal_subviews/attributes/date', $attribute); ?>
<?php break; ?>
<?php endswitch; ?>
<!-- Close form-group div -->
<?php if ($i % 2 == 0): ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php eT('Close') ?></button>
<button type="button" class="btn btn-primary action_save_modal_editParticipant"><?php eT("Save")?></button>
</div>
<script>
$('#editPartcipantActiveForm .bootstrap-switch').bootstrapSwitch();
</script>
<?php
$this->endWidget();
?>