_form.php
2.82 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
<?php
/**
* @var CActiveForm $form
*/
?>
<div>
<?php $form = $this->beginWidget('CActiveForm',
array(
'id' => 'admin-user-form',
'enableAjaxValidation' => false,
'htmlOptions' => array(
'class' => 'form-horizontal'
),
)); ?>
<fieldset>
<legend>Информация о пользователе</legend>
<!-- <p class="alert alert-info">Поля с <span class="required">*</span> обязательны.</p>-->
<?php echo $form->errorSummary($model); ?>
<div class="control-group<?php if ($model->hasErrors('username')) echo ' error'?>">
<?php echo $form->label($model, 'username', array('class' => 'control-label')); ?>
<div class="controls">
<?php echo $form->textField($model, 'username'); ?>
<span class="help-inline">
<?php
if ($model->hasErrors('username'))
echo $model->getError('username')?>
</span>
</div>
</div>
<div class="control-group<?php if ($model->hasErrors('password')) echo ' error'?>">
<?php echo $form->label($model, 'password', array('class' => 'control-label')); ?>
<div class="controls">
<?php echo $form->passwordField($model, 'password', array('autocomplete' => 'off')); ?>
<span class="help-inline">
<?php
if ($model->hasErrors('password'))
echo $model->getError('password')?>
</span>
</div>
</div>
<div class="control-group<?php if ($model->hasErrors('name')) echo ' error'?>">
<?php echo $form->label($model, 'name', array('class' => 'control-label')); ?>
<div class="controls">
<?php echo $form->textField($model, 'name'); ?>
<span class="help-inline">
<?php
if ($model->hasErrors('name'))
echo $model->getError('name')?>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Роли пользователя</label>
<div class="controls">
<?php foreach ($model->roles as $role => $roleName): ?>
<?php echo CHtml::label($form->checkBox($model, "role[$role]") . $roleName, "roleinp_$role", array('class' => 'checkbox')); ?>
<?php endforeach; ?>
</div>
</div>
</fieldset>
<div class="form-actions">
<button type="submit" class="btn btn-large btn-primary">
<?php echo ($model->isNewRecord ? 'Добавить' : 'Сохранить')?>
</button>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->