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.
193 lines
7.8 KiB
193 lines
7.8 KiB
<?php
|
|
include "header.php";
|
|
|
|
$id = isset($_GET['id']) ? $_GET['id'] : die('ERROR: Record ID not found.');
|
|
|
|
$db_query = "select * from meeting where id = '$id'";
|
|
$data = mysqli_query($link, $db_query);
|
|
|
|
foreach($data as $data) :
|
|
// 會議時間
|
|
$stime_str = $etime_str = "";
|
|
//$now_min = date("i");
|
|
//if ($now_min < 30) $next_start = date("H").":30:00";
|
|
//else $next_start = date("H", strtotime("+1 hour")).":00:00";
|
|
//$next_end = date("H:i:s", strtotime("+1 hour -1 second", strtotime($next_start)));
|
|
//echo $next_start."~".$next_end;
|
|
for ($i=8; $i<24; $i++) {
|
|
$hour = str_pad($i, 2, "0", STR_PAD_LEFT);
|
|
for ($j=0; $j<2; $j++) {
|
|
$min = str_pad($j*30, 2, "0", STR_PAD_LEFT);
|
|
$stime_sel = $hour.":".$min.":00";
|
|
$stime_str .= '<option value="'.$stime_sel.'"';
|
|
if ($data["stime"] == $stime_sel) $stime_str .= ' selected';
|
|
$stime_str .= '>'.substr($stime_sel, 0, 5).'</option>';
|
|
|
|
$min = str_pad($j*30+29, 2, "0", STR_PAD_LEFT);
|
|
$etime_sel = $hour.":".$min.":59";
|
|
$etime_sel_text = date("H:i", strtotime("+1 second", strtotime($etime_sel)));
|
|
$etime_str .= '<option value="'.$etime_sel.'"';
|
|
if ($data["etime"] == $etime_sel) $etime_str .= ' selected';
|
|
$etime_str .= '>'.$etime_sel_text.'</option>';
|
|
}
|
|
}
|
|
|
|
//if ($data["attend"]) {
|
|
$attend_arr = $attend_id_arr = [];
|
|
//$join_str = "";
|
|
if ($data["attend"]) $attend_id_arr = explode(",", $data["attend"]);
|
|
|
|
// 與會人員部門選單
|
|
$attend_str = "";
|
|
$sql = "select department_id, name from department group by department_id order by department_id;";
|
|
$res = mysqli_query($link, $sql);
|
|
while ($row = mysqli_fetch_row($res)) {
|
|
list($department_id, $department_name) = $row;
|
|
$sql2 = "select accountid, name from account where department_id = '$department_id' order by role_id";
|
|
$res2 = mysqli_query($link, $sql2);
|
|
while ($row2 = mysqli_fetch_row($res2)) {
|
|
$attend_str .= '<option value="'.$row2[0].'" data-section="'.$department_name.'" data-index="1"';
|
|
if (in_array($row2[0], $attend_id_arr)) $attend_str .= ' selected';
|
|
$attend_str .= '>'.$row2[1].'</option>';
|
|
}
|
|
mysqli_free_result($res2);
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
/*
|
|
$aid_str = str_replace(",", "','", $data["attend"]);
|
|
$sql = "select distinct a.accountid, a.name, d.name 'department_name' from account a, department d ";
|
|
$sql .= "where a.department_id = d.department_id and a.accountid in ('$aid_str')";
|
|
$res = mysqli_query($link, $sql);
|
|
while ($row = mysqli_fetch_array($res)) {
|
|
$attend_arr[$row["accountid"]]["name"] = $row["name"];
|
|
$attend_arr[$row["accountid"]]["department_name"] = $row["department_name"];
|
|
}
|
|
mysqli_free_result($res);
|
|
|
|
foreach ($attend_id_arr as $k => $v) {
|
|
$join_str .= '<div class="item" data-key="'.$k.'" data-value="'.$v.'"><span class="remove-selected">×</span>'.$attend_arr[$v]["name"].'<span class="section-name">'.$attend_arr[$v]["department_name"].'</span></div>';
|
|
}
|
|
*/
|
|
|
|
//}
|
|
/*
|
|
<div class="selected ui-sortable">
|
|
|
|
<div class="item" data-key="0" data-value="M0001">
|
|
<span class="remove-selected">×</span>許作名<span class="section-name">管理總處</span>
|
|
</div>
|
|
|
|
<div class="item" data-key="1" data-value="M0006">
|
|
<span class="remove-selected">×</span>蔡定憲<span class="section-name">管理總處</span>
|
|
</div>
|
|
|
|
<div class="item" data-key="2" data-value="M0010">
|
|
<span class="remove-selected">×</span>葉俊麟<span class="section-name">管理總處</span>
|
|
</div>
|
|
|
|
<div class="item" data-key="3" data-value="M0093">
|
|
<span class="remove-selected">×</span>江振寬<span class="section-name">管理總處</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
*/
|
|
?>
|
|
<link rel="stylesheet" href="css/tree/jquery.tree-multiselect.min.css">
|
|
<script src="css/tree/jquery-ui.min.js"></script>
|
|
<script src="css/tree/jquery.tree-multiselect.js"></script>
|
|
|
|
<div class="container">
|
|
<form class="form-inline" method="post" action="meeting-record-update.php">
|
|
<div>
|
|
<label for="title">會議主題</label>
|
|
<input type="text" name="title" id="title" size="30" maxlength="25" value="<?php echo $data['title']; ?>" required>
|
|
</div>
|
|
<div>
|
|
<label for="mdate">會議日期</label><br>
|
|
<input type="date" name="mdate" id="mdate" class="form-control" value="<?php echo $data['mdate']; ?>" required>
|
|
</div>
|
|
<div>
|
|
<label for="stime">開始時間</label><br>
|
|
<select name="stime">
|
|
<?php echo $stime_str; ?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="etime">結束時間</label><br>
|
|
<select name="etime">
|
|
<?php echo $etime_str; ?>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="room">地點</label>
|
|
<select name="room" id="room" required>
|
|
<option value="">請選擇</option>
|
|
<option value="1"<?php if ($data['room']==1) echo " selected"; ?>>C區會議室1</option>
|
|
<option value="2"<?php if ($data['room']==2) echo " selected"; ?>>C區會議室2</option>
|
|
<option value="3"<?php if ($data['room']==3) echo " selected"; ?>>大直會議室</option>
|
|
<option value="4"<?php if ($data['room']==4) echo " selected"; ?>>網路會議</option>
|
|
<option value="5"<?php if ($data['room']==5) echo " selected"; ?>>其他</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label for="equip">使用資源</label>
|
|
<input type="text" name="equip" id="equip" value="<?php echo $data['equip']; ?>" size="30" maxlength="25">
|
|
</div>
|
|
<div>
|
|
<label for="content">會議內容</label><br>
|
|
<textarea class="form-control" name="content" id="content" rows="8" cols="70" required><?php echo $data['content']; ?></textarea>
|
|
</div>
|
|
<div style="width:100%">
|
|
<label for="attend">與會人員</label><br>
|
|
<select id="attend" multiple="multiple">
|
|
<?php echo $attend_str; ?>
|
|
</select>
|
|
</div>
|
|
<?php if (($user_auth&2) && $data["creater"] == $user_id) { ?>
|
|
<div>
|
|
<br>
|
|
<button type="submit" name="update" id="update">確定</button>
|
|
<h4 class="text-danger">按下「確定」後,系統將發信通知已勾選的與會人員!</h4>
|
|
</div>
|
|
<?php } ?>
|
|
<input type="hidden" name="id" value="<?php echo $id; ?>">
|
|
<input type="hidden" name="creater" value="<?php echo $data["creater"]; ?>">
|
|
<input type="hidden" name="create_at" value="<?php echo date("Y-m-d H:i:s"); ?>">
|
|
<input type="hidden" name="attend_all" id="attend_all">
|
|
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
|
</form>
|
|
</div>
|
|
<script>
|
|
var tree = $("#attend").treeMultiselect({
|
|
allowBatchSelection: true,
|
|
//enableSelectAll: true,
|
|
//searchable: true,
|
|
sortable: true,
|
|
startCollapsed: true
|
|
});
|
|
$(function(){
|
|
/*
|
|
// 先不提供編輯人員功能
|
|
$('.selections').hide();
|
|
$('.item').each(function(){
|
|
$('.remove-selected').remove();
|
|
})
|
|
*/
|
|
//////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
//$('.ui-sortable').html('<?php echo $join_str; ?>');
|
|
$('#update').click(function(){
|
|
$('#attend_all').val($("#attend").val());
|
|
});
|
|
});
|
|
</script>
|
|
<?php
|
|
endforeach;
|
|
|
|
include "footer.php";
|
|
?>
|