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.
 
 
 
 
 
 

130 lines
3.5 KiB

<?php
ini_set('display_errors', 'on');
include "header.php";
// 設置一個空陣列來放資料
$data = array();
// sql語法存在變數中
$sql = "select * from notice ";
$sql .= "
where (
permission like '%" . $user_id . "%'
or permission = 'ALL'
-- or creater = '$user_id'
)
";
$sql .= "order by id";
// 用mysqli_query方法執行(sql語法)將結果存在變數中
$data = mysqli_query($link, $sql);
?>
<!--
<p>
<a href="notice-create.php?<?php echo $token_link; ?>" class="btn btn-info btn-sm">
<span class="glyphicon glyphicon-plus"></span>
</a>
</p>
-->
<?php
if ($data) :
?>
<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>
<th>項次</th>
<th>類別</th>
<th>標題</th>
<th>內容</th>
<th>確認</th>
<th>已讀</th>
<th>建檔人</th>
<th>建檔時間</th>
</tr>
</thead>
<tbody>
<?php foreach ($data as $data) : ?>
<tr>
<td><?php echo $data['id']; ?></td>
<td><?php if ($data['kind'] == '1') echo "系統";
else echo "會議"; ?></td>
<td><?php echo $data['title']; ?></td>
<td><?php echo $data['content']; ?></td>
<td>
<?php
if ($data['haveread'] == '1')
echo "已確認";
else
echo "新通知"; ?>
</td>
<!-- <td><button onclick="checked(event, <?php echo $data['id']; ?>)" >不再通知</button></td> -->
<td><a href="notice-delete.php?id=<?php echo $data['id']; ?>&<?php echo $token_link; ?>" class="btn btn-info btn-sm" onClick="return confirm('確認關閉通知嗎?')">
<span class="glyphicon glyphicon-ok"></span>
</a></td>
<td><?php echo !empty(accountidToName($data['creater'])) ? accountidToName($data['creater']) : $data['creater']; ?></td>
<td><?php echo $data['create_at']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script>
$('#table_index').DataTable({
"order": [
[4, "desc"],
[0, "desc"]
]
});
</script>
<?php
else :
echo "<h2>There is no record!</h2>";
endif;
#代表結束連線
mysqli_close($link);
include "footer.php";
?>