_form.php
7.92 KB
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
<div class="form">
<?php
/**
* @var BHorizontalForm $form
* @var Action $model
* @var ActionI18n[] $i18nModels
*/
?>
<?php $form = $this->beginWidget('BHorizontalForm', array(
'id' => 'action-form',
'enableAjaxValidation' => false,
'htmlOptions' => array(
'enctype' => 'multipart/form-data',
),
)); ?>
<!--
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
-->
<div class="control-group <?php echo ($model->hasErrors('hidden') ? ' error' : '') ?>">
<?php echo $form->label($model, 'hidden', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->checkBox($model, "hidden"); ?>
<?php echo $form->error($model, 'hidden'); ?>
</div>
</div>
<div class="control-group <?php echo ($model->hasErrors('action_category_id') ? ' error' : '') ?>">
<?php echo $form->label($model, 'action_category_id', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->dropDownList($model, 'action_category_id', CHtml::listData(ActionCategory::model()->with('i18n')->findAll(), 'id', 'i18n.name')); ?>
<?php echo $form->error($model, 'action_category_id'); ?>
</div>
</div>
<div class="control-group <?php echo ($model->hasErrors('link') ? ' error' : '') ?>">
<?php echo $form->label($model, 'link', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($model, 'link', array('size' => 60, 'maxlength' => 64)); ?>
<?php echo $form->error($model, 'link'); ?>
</div>
</div>
<div class="control-group <?php echo ($model->hasErrors('contactIds') ? ' error' : '') ?>">
<?php echo $form->label($model, 'contactIds', array('class' => 'control-label'))?>
<div class="controls">
<?php
$this->widget('MultiSelect',array(
'data'=>Contact::listWithSelected($model->getContactIds()),
'model'=>$model,
'attribute'=>'contactIds',
'htmlOptions'=>array(
'style'=>'min-width:600px; min-height:200px;'
)
)); ?>
<?php //echo Chosen::activeMultiSelect($model, 'contactIds', CHtml::listData(Contact::model()->findAll(), 'id', 'i18n.name')); ?>
<?php echo $form->error($model, 'contactIds'); ?>
</div>
</div>
<?php
echo $form->controlGroup($model, 'image',
$form->fileField($model, 'image') . '<br/>' .
CHtml::image($model->imageBehavior->getFileUrl('preview')));
?>
<div class="control-group <?php echo ($model->hasErrors('date_start') ? ' error' : '') ?>">
<?php echo $form->label($model, 'date_start', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($model, 'date_start'); ?>
<?php echo $form->error($model, 'date_start'); ?>
</div>
</div>
<div class="control-group <?php echo ($model->hasErrors('date_end') ? ' error' : '') ?>">
<?php echo $form->label($model, 'date_end', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($model, 'date_end'); ?>
<?php echo $form->error($model, 'date_end'); ?>
</div>
</div>
<div class="control-group <?php echo ($model->hasErrors('is_finished') ? ' error' : '') ?>">
<?php echo $form->label($model, 'is_finished', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->checkBox($model, 'is_finished'); ?>
<?php echo $form->error($model, 'is_finished'); ?>
</div>
</div>
<?php
/**
* @var BTabs $tabs
*/
$tabs = $this->beginWidget('BTabs');
foreach ($i18nModels as $lang => $i18nModel):
?>
<?php $tabs->beginTab(Yii::app()->params['languageNames'][$lang]) ?>
<div class="control-group <?php echo ($i18nModel->hasErrors('name') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'name', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($i18nModel, "[$lang]name", array('size' => 60, 'maxlength' => 64)); ?>
<?php echo $form->error($i18nModel, 'name'); ?>
</div>
</div>
<div class="control-group <?php echo ($i18nModel->hasErrors('page_name') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'page_name', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($i18nModel, "[$lang]page_name", array('size' => 60, 'maxlength' => 512)); ?>
<?php echo $form->error($i18nModel, 'page_name'); ?>
</div>
</div>
<div class="control-group <?php echo ($i18nModel->hasErrors('short') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'short', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textarea($i18nModel, "[$lang]short", array('rows' => 6, 'cols' => 50)); ?>
<?php echo $form->error($i18nModel, 'short'); ?>
</div>
</div>
<div class="control-group <?php echo ($i18nModel->hasErrors('content') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'content', array('class' => 'control-label'))?>
<div class="controls">
<?php
$this->widget('TinyMce', array(
'model' => $i18nModel,
'attribute' => "[$lang]content",
'htmlOptions' => array(
'rows' => 6,
'cols' => 60,
),
));
?>
<?php echo $form->error($i18nModel, 'content'); ?>
</div>
</div>
<?php echo $form->beginFieldset('СЕО Параметры'); ?>
<div class="control-group <?php echo ($i18nModel->hasErrors('title') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'title', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textField($i18nModel, "[$lang]title", array('size' => 60, 'maxlength' => 512)); ?>
<?php echo $form->error($i18nModel, 'title'); ?>
</div>
</div>
<div class="control-group <?php echo ($i18nModel->hasErrors('keywords') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'keywords', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textArea($i18nModel, "[$lang]keywords", array('rows' => 6, 'cols' => 50)); ?>
<?php echo $form->error($i18nModel, 'keywords'); ?>
</div>
</div>
<div class="control-group <?php echo ($i18nModel->hasErrors('description') ? ' error' : '') ?>">
<?php echo $form->label($i18nModel, 'description', array('class' => 'control-label'))?>
<div class="controls">
<?php echo $form->textArea($i18nModel, "[$lang]description", array('rows' => 6, 'cols' => 50)); ?>
<?php echo $form->error($i18nModel, 'description'); ?>
</div>
</div>
<?php echo $form->endFieldset(); ?>
<?php $tabs->endTab() ?>
<?php
endforeach;
$this->endWidget();
?>
<div class="form-actions">
<button type="submit" class="btn btn-large btn-primary">
<?php echo ($model->isNewRecord ? 'Создать' : 'Сохранить'); ?>
</button>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
<script>
$( "#Action_date_start" ).datepicker({ dateFormat: 'yy-mm-dd' });
$( "#Action_date_end" ).datepicker({ dateFormat: 'yy-mm-dd' });
</script>