-
Notifications
You must be signed in to change notification settings - Fork 0
/
paiban.php
156 lines (150 loc) · 7.11 KB
/
paiban.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
150
151
152
153
154
155
156
<?php
/**
* Created by PhpStorm.
* User: linzy
* Date: 2018/04/26
* Time: 22:32
*/
include_once ("inc.php");
include_once('sidebar.php');
if(isset($_GET['phase'])){
$phase_id=$_GET['phase'];
}else{
$sql="SELECT phase_id FROM paiban_phase_info ORDER BY start_date DESC LIMIT 1";
$result=mysqli_query($conn,$sql);
$row = mysqli_fetch_assoc($result);
$phase_id=$row["phase_id"];
}
//引入sql
include_once("paiban_sql.php");
?>
<div class="container-fluid">
<!-- Breadcrumbs-->
<ol class="breadcrumb">
<li class="breadcrumb-item">
e修哥
</li>
<li class="breadcrumb-item">排班</li>
<li class="breadcrumb-item"><?php echo $phase_id;?>期</li>
</ol>
<!-- <form action="paiban_post.php?id=--><?php //echo $user_id;?><!--" method="post">-->
<!-- <div class="bd-example">-->
<!-- <div class="btn-group btn-group-toggle" data-toggle="buttons">-->
<!-- <label class="btn btn-secondary active">-->
<!-- <input type="checkbox" name="choices[]" value="dd" id="option3" checked="" autocomplete="off"> 经过-->
<!-- </label>-->
<!-- <label class="btn btn-secondary">-->
<!-- <input type="checkbox" name="choices[]" value="dd" id="option3" autocomplete="off"> 经过-->
<!-- </label>-->
<!-- <input type="submit" value="Go!" />-->
<!-- </div>-->
<!-- </div>-->
<!-- </form>-->
<!-- <form action="paiban_post.php?id=--><?php //echo $user_id;?><!--" method="post">-->
<!-- <div class="bd-example">-->
<!-- <div class="btn-group btn-group-toggle" data-toggle="buttons">-->
<!-- <label class="btn btn-outline-primary active">-->
<!-- <input type="checkbox" name="choices[]" value="aa" id="option3" checked="" autocomplete="off"> 1/2-->
<!-- </label>-->
<!-- <label class="btn btn-outline-primary">-->
<!-- <input type="checkbox" name="choices[]" value="bb" id="option3" autocomplete="off"> 1/4-->
<!-- </label>-->
<!-- </div>-->
<!-- <input class="btn btn-primary active" type="submit" value="提交">-->
<!-- </div>-->
<!-- </form>-->
<?php if($is_phase_active==0){ ?>
<div class="alert alert-warning" role="alert">
本期选班已结束.
</div>
<?php }
//错误代码
if(isset($_GET['errcode'])){
if($_GET['errcode']==0) { ?>
<div class="alert alert-success" role="alert">
<strong>提交成功!</strong>
</div>
<?php }else{
$post_err=array(
"1"=>"参数错误",
"2"=>"参数错误 该期目前不可修改",
"3"=>"有班次人数已满",
"4"=>"数据库写入错误,请重试"
);
for($i=1;$i<=4;$i++){
if(!getstatus($_GET['errcode'],$i)) continue;
?>
<div class="alert alert-danger" role="alert">
<strong>提交失败:</strong><?php echo $post_err[$i];?>.
</div>
<?php }}}?>
<!-- 已选状态-->
<div class="card mb-3">
<div class="card-body">
当前已选 <?php echo count($usergroup_data);?> 班. 建议选择 <?php echo $this_phase_data['per_num'];?> 班.
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-table"></i>排班表</div>
<div class="card-body">
<div class="table-responsive">
<form action="paiban_post.php?id=<?php echo $user_id;?>&phase=<?php echo $phase_id;?>" method="post">
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<?php for($i=1;$i<=count($time_data);$i++) { ?>
<th><?php echo $time_data[$i]['begin_time']; ?>-<?php echo $time_data[$i]['end_time']; ?></th>
<?php }?>
</tr>
</thead>
<tbody>
<?php
//排班表输出
$i=0;
$k=0;
while($i<count($group_data)){
echo "<tr>";
$j=1;
echo "<td>".date_format_week($group_data[$i]['date']).'('.date("m-d",strtotime($group_data[$i]['date'])).')'."</td>";
while($j<=count($time_data)){
?> <td> <?php
if($i<count($group_data) && $group_data[$i]['time_id']==$j){
$t_group_id=$group_data[$i]['group_id'];
$username_stmt->bind_param("ii", $phase_id,$t_group_id);
$username_stmt->execute();
$username_result = $username_stmt->get_result();
//选单按钮处理
$num_ex=mysqli_num_rows($username_result);
$group_user_num=$group_data[$i]['user_num'];
?>
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-outline-info btn-sm <?php echo @in_array($t_group_id,$usergroup_data)?'active':null; ?> <?php echo (($num_ex>=$group_user_num) &&!@in_array($t_group_id,$usergroup_data))?'disabled':null ?>">
<input type="checkbox" name="group_choices[]" value="<?php echo $t_group_id; ?>" <?php echo @in_array($t_group_id,$usergroup_data)?'checked=""':null; ?> autocomplete="off">
<?php
echo "$num_ex/$group_user_num"?>
</label>
</div>
<?php
while($row = mysqli_fetch_assoc($username_result)) {
echo $row['name'].' ';
}
$i++;
$t_group_id=null;
}
?> <?php
$j++;
}
echo "</tr>";
}
?>
</tbody>
</table>
<input class="btn btn-info" type="submit" value="提交" <?php echo ($is_phase_active)?null:'disabled' ?>>
</form>
</div>
</div>
</div>
</div>
<?php include_once('footer.php'); ?>