-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacters.php
149 lines (131 loc) · 5.9 KB
/
Characters.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
144
145
146
147
148
149
<?php
$title = "Characters";
include 'header.php';
include "DBHelper.php";
include "db_queries.php";
?>
<div class="container">
<div class="row col-md-12 tBorder">
<table id="dynamicT" name="dynamicT" class="table table-striped display custab table-bordered" cellspacing="0" width="100%">
<thead class="tableH">
<tr>
<!--<th class="text-center">ID</th>-->
<th>First Name</th>
<th>Last Name</th>
<th>Call Sign</th>
<th>Title</th>
<th>Gender</th>
<th>Iconic</th>
<th class="text-center">Homeworld</th>
<th class="text-center">Actions</th>
</tr>
</thead>
<?php
if (db_connect()) {
//echo "Connected!";
//$result = db_generic_select($bsg_db_select_people);
$result = db_generic_select($swdb_char_selec_all);
$arr_len = count($result);
//echo " " . $arr_len;
for ($x = 0; $x < $arr_len; $x++) {
$p_qry = "SELECT p.plan_name FROM swdb_planets p WHERE p.pid = ". $result[$x]['Planets_pid'] ."";
$plan_qry = db_generic_select($p_qry);
if($result[$x]['iconic'] == 0) {
$icon = "<span class=\"glyphicon glyphicon-ok\" style=\"color:#5ef93b\"></span>";
} else {
$icon = "<span class=\"glyphicon glyphicon-remove\" style=\"color:#ea1e1e\"></span>";
}
echo "<tr>";
//echo "<td class=\"text-center\">" . $result[$x]['cid'] . "</td>";
echo "<td>" . $result[$x]['f_name'] . "</td>";
echo "<td>" . $result[$x]['l_name'] . "</td>";
echo "<td>" . $result[$x]['call_sign'] . "</td>";
echo "<td>" . $result[$x]['title'] . "</td>";
echo "<td>" . $result[$x]['Gender'] . "</td>";
echo "<td class=\"text-center\">" . $icon . "</td>";
echo "<td class=\"text-center\">" . $plan_qry[0]['plan_name'] . "</td>";
echo "<td nowrap=\"nowrap\ class=\"text-center\"><a class="
. "\"btn btn-info btn-xs\" href=\"CharEdit.php?id=". $result[$x]['cid'] ."\"><span class="
. "\"glyphicon glyphicon-edit\"></span> Edit </a>"
. " <a href=\"CharDelete.php?id=" .$result[$x]['cid'] ."\" class=\"btn btn-danger btn-xs\">"
. "<span class=\"glyphicon glyphicon-remove\">"
. "</span> Delete </a></td>";
echo "</tr>";
}
} else {
//echo "FAILED!";
}
?>
</table>
<script>
$(document).ready(function() {
$('#dynamicT').DataTable();
});
</script>
</div>
<!-- START MODAL -->
<div class="container">
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Add a Character</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Add a character to the UO SWDB</h4>
</div>
<div class="modal-body">
<form action="CharInsert.php" method="post">
<div class="form-group">
<label for="fname">First Name:</label>
<input type="text" class="form-control" id="fname" name="fname">
</div>
<div class="form-group">
<label for="lname">Last Name:</label>
<input type="text" class="form-control" id="lname" name="lname">
</div>
<div class="form-group">
<label for="callsign">Call sign:</label>
<input type="text" class="form-control" id="callsign"name="callsign">
</div>
<div class="form-group">
<label for="title">Title:</label>
<input type="text" class="form-control" id="title"name="title">
</div>
<div class="form-group">
<label for="gender">Gender:</label>
<label class="radio-inline"><input type="radio" name="gender" value="male" checked>Male</label>
<label class="radio-inline"><input type="radio" name="gender" value="female">Female</label>
</div>
<div class="form-group">
<label class="checkbox-inline"><input type="checkbox" name="iconic" id="iconic" value="TRUE"> Iconic</label>
</div>
<div class="form-group">
<label class="planet_select">Select Home Planet:</label>
<?php
$get_planets_for_dd = db_query($sql_select_planet_names);
echo '<select name="planetselect" class="form-control" id="planet_select">';
foreach($get_planets_for_dd as $qry) {
echo '<option value="' . $qry['pid'] . '" name="' .$qry['pid'] . '">' . $qry['plan_name'] . '</option>';
}
echo '</select>';
?>
</select>
</div>
<button type="submit" name="submit" class="btn btn-default">Submit</button>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
</div>
<!-- END MODAL -->
</div>
<?php
include 'footer.php';
?>