add.php
3.13 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
<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="/count_form.php/?p=admin&sp=add" 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" name="question_text">
</div>
<p>
<label for="status">Инпут выбора</label>
<select id="status" name="question_input_type">
<option value="checkbox" selected>checkbox</option>
<option value="radio">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" name="question_weight">
</div>
<div class="input-group">
<label><input type="checkbox" data-оbligatory="true" value="1" checked name="question_status">Опубликован</label>
</div>
<div class="input-group">
<label><input type="checkbox" data-оbligatory="true" value="1" name="question_required">Активный</label>
</div>
<h2>Родительская услуга</h2>
<div id="roleList">
<input type="radio" class="main-role" name="question_parent_id" value="0" checked>Нет
<?php
function showRole($array,$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" name="question_parent_id" value="<?=$array[$i]['id']?>"><?=$array[$i]['text']?></label>
<?php
$key=$array[$i]['id'];
showRole($array,$key);
$key = $array[$i]['parent_id'];
?>
</li>
</ul>
</div>
<?php } else { ?>
<ul >
<li><label><input type="radio" name="question_parent_id" value="<?=$array[$i]['id']?>"><?=$array[$i]['text']?></label>
<?php
$key=$array[$i]['id'];
showRole($array,$key);
$key = $array[$i]['parent_id'];
echo "</li>";
echo "</ul>";
}
}
}
}
$key=0;
showRole($data['data'],$key);?>
</div>
<p>
<input type="submit" id="send-button" class="button_style" value="Добавить">
</p>
</form>
<script src="/count_form/js/validate.js"></script>