edit.php
4.23 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
<header>
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<ul class="nav navbar-nav">
<li><a href="/count_form.php/?p=admin">Услуги</a></li>
<li><a href="/count_form.php/?p=sub_quest">Вопросы</a></li>
<li><a href="http://seo.artweb.ua/count_form.php/">Выйти</a></li>
</ul>
</nav>
</header>
<h1>Обновить услугу</h1>
<form id = "send-form" data-url="" action="" method="post">
<div class="input-group">
<span class="input-group-addon title-block-sizing">Услуга</span>
<input type="text" data-reg="name" data-оbligatory="true" class="form-control input-sizing validate-input" value="<?= isset($data['question']['text'])&&!empty($data['question']['text']) ? $data['question']['text'] : '' ?>" name="question_text">
</div>
<p>
<label for="status">Инпут выбора</label>
<select id="status" name="question_input_type">
<option value="checkbox" <?= isset($data['question']['input_type'])&&!empty($data['question']['input_type'])&& $data['question']['input_type'] == 'checkbox' ? 'selected' : '' ?> >checkbox</option>
<option value="radio" <?= isset($data['question']['input_type'])&&!empty($data['question']['input_type'])&& $data['question']['input_type'] == 'radio' ? 'selected' : '' ?> >radio</option>
</select>
</p>
<div class="input-group">
<span class="input-group-addon title-block-sizing">Вес</span>
<input type="text" data-reg="" data-оbligatory="true" class="form-control input-sizing validate-input" value="<?= isset($data['question']['weight'])&&!empty($data['question']['weight']) ? $data['question']['weight'] : '' ?>" name="question_weight">
</div>
<div class="input-group">
<label><input type="checkbox" <?= isset($data['question']['status'])&&!empty($data['question']['status']) ? 'checked' : '' ?> data-оbligatory="true" value="1" name="question_status">Опубликован</label>
</div>
<div class="input-group">
<label><input type="checkbox" <?= isset($data['question']['required'])&&!empty($data['question']['required']) ? 'checked' : '' ?> data-оbligatory="true" value="1" name="question_required">Активный</label>
</div>
<h2>Родительская услуга</h2>
<div id="roleList">
<input type="radio" <?= isset($data['question']['parent_id'])&&!empty($data['question']['parent_id'])&& $data['question']['parent_id'] == '0'? 'checked' : '' ?> class="main-role" name="question_parent_id" value="0" checked>Нет
<?php
function showRole($array,$data,$key){
$num=count($array);
for($i=0; $i<$num; $i++){
if($array[$i]['parent_id']==$key){
if($key == 0){?>
<div><ul><li><label><input type="radio" class="main-role" <?= isset($data['parent_id'])&&!empty($data['parent_id'])&& $array[$i]['id'] == $data['parent_id'] ? 'checked' : '' ?> name="question_parent_id" value="<?=$array[$i]['id']?>"><?=$array[$i]['text']?></label>
<?php
$key=$array[$i]['id'];
showRole($array,$data,$key);
$key = $array[$i]['parent_id'];
?>
</li>
</ul>
</div>
<?php } else { ?>
<ul >
<li><label><input type="radio" <?= isset($data['question']['parent_id'])&&!empty($data['parent_id'])&& $array[$i]['id'] == $data['parent_id'] ? 'checked' : '' ?> name="question_parent_id" value="<?=$array[$i]['id']?>"><?=$array[$i]['text']?></label>
<?php
$key=$array[$i]['id'];
showRole($array,$data,$key);
$key = $array[$i]['parent_id'];
echo "</li>";
echo "</ul>";
}
}
}
}
$key=0;
showRole($data['data'],$data['question'], $key);?>
</div>
<p>
<input type="submit" id="send-button" class="button_style" value="Сохранить">
</p>
</form>
<script src="/count_form/js/validate.js"></script>