You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
3.5 KiB
136 lines
3.5 KiB
<?php
|
|
#由系統自斷產生include 'XXXXX-schema.php';;
|
|
|
|
include 'day_off-schema.php';
|
|
include "../header.php";
|
|
|
|
// 工務總處可瀏覽全部資料
|
|
$sql = "select department_id from account where accountid = '$user_id'";
|
|
$res = mysqli_query($link, $sql);
|
|
$row = mysqli_fetch_row($res);
|
|
$user_department_id = $row[0];
|
|
mysqli_free_result($res);
|
|
|
|
// 設置一個空陣列來放資料
|
|
$data = array();
|
|
// sql語法存在變數中
|
|
$sql_cmd = sql_myself($user_id);
|
|
if ($user_department_id == "50") $sql_cmd = "";
|
|
$sql = "SELECT * FROM $system_name $sql_cmd ORDER BY id";
|
|
|
|
// 用mysqli_query方法執行(sql語法)將結果存在變數中
|
|
$data = mysqli_query($link, $sql);
|
|
?>
|
|
|
|
<!-- <a href="create.php"><h2>新增</h2></a> -->
|
|
<?php if ($user_auth & 2) { ?>
|
|
<p>
|
|
<a href="<?php echo $system_name; ?>-create.php?function_name=contract&<?php echo $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</a>
|
|
</p>
|
|
<?php
|
|
}
|
|
if ($data) :
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
if (empty($_POST["name"]) && empty($_POST["email"]) && empty($_POST["website"])) {
|
|
echo "<p class='error'>Please fill up the required field!</p>";
|
|
} else {
|
|
header("Location:$system_nam-index.php");
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<style>
|
|
table {
|
|
table-layout: fixed;
|
|
width: 100%;
|
|
}
|
|
|
|
td {
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
img {
|
|
width: 125px;
|
|
}
|
|
|
|
.width_style_1 {
|
|
width: 125px;
|
|
}
|
|
|
|
table {
|
|
width: 100%;
|
|
}
|
|
|
|
#table_index_filter {
|
|
float: right;
|
|
}
|
|
|
|
#table_index_paginate {
|
|
float: right;
|
|
}
|
|
|
|
label {
|
|
display: inline-flex;
|
|
margin-bottom: .5rem;
|
|
margin-top: .5rem;
|
|
|
|
}
|
|
</style>
|
|
|
|
<div style="overflow-x:auto;">
|
|
<table id="table_index" class="table table-striped table-bordered" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<?php
|
|
for ($i = 0; $i < count($html_schema); ++$i) {
|
|
echo "<th>" . $html_schema[$i]["label"] . "</th>";
|
|
}
|
|
?>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<th>修改</th>
|
|
<!--<th>刪除</th>-->
|
|
<?php } ?>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
<?php foreach ($data as $data) : ?>
|
|
<tr>
|
|
<?php
|
|
for ($i = 0; $i < count($html_schema); ++$i) {
|
|
echo "<td>" . $data[$html_schema[$i]["id"]] . "</td>";
|
|
}
|
|
?>
|
|
<?php if ($user_auth & 2) { ?>
|
|
<td>
|
|
<p>
|
|
<a href="<?php echo $system_name . "-edit.php?id=" . $data['id'] . "&function_name=" . $system_name . "&" . $token_link; ?>" class="btn btn-info btn-sm">
|
|
<span class="glyphicon glyphicon-pencil"></span>
|
|
</a>
|
|
</p>
|
|
</td>
|
|
|
|
<?php } ?>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
else :
|
|
echo "<h2>There is no record!</h2>";
|
|
endif;
|
|
|
|
#代表結束連線
|
|
mysqli_close($link);
|
|
|
|
include "../footer.php";
|
|
|
|
?>
|