This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
promotion.php
188 lines (171 loc) · 8.21 KB
/
promotion.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
include('class.token.php');
require 'inc/head.php';
global $re;
$cl=output(@$_GET['cl']);
$gr=output(@$_GET['gr']);
?>
<div class="row">
<div class="col-md-12">
<h2> گواستنەوەی قۆناغەکان</h2>
<h5>گواستنەوەی خوێندکاران و هەژمارکردنیان بەکەوتوو یان دەرچوو</h5>
</div>
</div>
<!-- /. ROW -->
<hr />
<div class="row mark">
<div class="col-md-12">
<?php if(!isset($_GET['view']) AND !isset($_GET['edit'])) { ?>
<form action="" method="get">
<div class="col-md-6">
<div class="form-group">
<label>قۆناغ</label>
<select class="selectpicker" data-width="100%" name="cl" class="form-control">
<option <?php va(@$_GET['cl'],1); ?> value="1">1</option>
<option <?php va(@$_GET['cl'],2); ?> value="2">2</option>
<option <?php va(@$_GET['cl'],3); ?> value="3">3</option>
<option <?php va(@$_GET['cl'],4); ?> value="4">4</option>
</select>
</div>
</div>
<div class="col-md-5">
<div class="form-group">
<label>گروپ</label>
<select class="selectpicker" data-width="100%" name="gr" class="form-control">
<option value="">هەموو گروپەکان</option>
<option <?php va(@$_GET['gr'],"A"); ?> value="A">A</option>
<option <?php va(@$_GET['gr'],"B"); ?> value="B">B</option>
<option <?php va(@$_GET['gr'],"C"); ?> value="C">C</option>
<option <?php va(@$_GET['gr'],"D"); ?> value="D">D</option>
</select>
</div>
</div>
<div class="col-md-1">
<div class="form-group">
<label style="color: #fff;">_</label>
<button data-toggle="tooltip" data-placement="top" title="" data-original-title="گەڕان" type="submit" style="float: right;" class="btn btn-info"><i class="fa fa-search"></i> گەڕان</button>
</div>
</div>
</form>
</div>
</div>
<hr>
<!-- /. ROW -->
<!-- Advanced Tables -->
<?php
if (isset($_POST['save'])) {$rowCount=0;
foreach ($_POST['stu'] as $key=>$stu_id) {
$res=output($_POST['res'][$key]);
$cl=output($cl);
if ($res==1 AND ndb("stu","id='$stu_id' AND class='$cl'")==1) {
$stm = $db->prepare("UPDATE stu SET class = class + 1 WHERE id=:id");
$stm->bindParam(":id",$stu_id , PDO::PARAM_STR);
$stm->execute();
$rowCount = $stm->rowCount();
}
}
re("info","سوپاس","$rowCount خوێندکار بەسەرکەوتویی گوازرانەوە.");
}
?>
<?php if (isset($cl) AND $cl!="") { ?>
<div class="row">
<div class="col-md-12">
<!-- Advanced Tables -->
<div class="panel panel-default">
<div class="panel-heading">
لیستی خوێندکاران
</div>
<div class="panel-body">
<div class="table-responsive">
<form action="" method="post">
<table id="" class="table table-striped table-bordered table-hover" data-id="dataTables-example">
<thead>
<tr>
<th width="50px">#</th>
<th>ناوی تەواوەتی</th>
<?php
$stm = $db->prepare("SELECT * FROM sub WHERE cl=:cl");
$stm->bindParam(":cl",$cl , PDO::PARAM_STR);
$stm->execute();
$rowCount = $stm->rowCount();
if($rowCount > 0){
while ($row=$stm->fetch(PDO::FETCH_ASSOC)) {
echo '<th style="width:50px;font-size:11px">'.$row['sn'].'</th>';
}
}
?>
<th width="50px">بار</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET['cl']) AND $_GET['cl']!='') {
$stm = $db->prepare("SELECT * FROM stu WHERE class=:cl");
if (isset($_GET['gr']) AND $gr!='') {
$stm = $db->prepare("SELECT * FROM stu WHERE class=:cl AND gr=:gr");
$stm->bindParam(":gr",$gr, PDO::PARAM_STR);
}
$stm->bindParam(":cl",$cl, PDO::PARAM_STR);
}
$stm->execute();
$rowCount = $stm->rowCount();
if($rowCount > 0){
$id=0;
while($row = $stm->fetch(PDO::FETCH_ASSOC)) { $id++;
?>
<tr>
<td><?=$id;?></td>
<td><?=$row['fname'];?></td>
<?php
$result=1;
$stmMark = $db->prepare("SELECT * FROM sub WHERE cl=:cl");
$stmMark->bindParam(":cl",$cl , PDO::PARAM_STR);
$stmMark->execute();
$rowCountMark = $stmMark->rowCount();
if($rowCountMark > 0){
while ($rowMark=$stmMark->fetch(PDO::FETCH_ASSOC)) {
$stmTotal = $db->prepare("SELECT * FROM mark_data WHERE student_id=:stu AND subject_id=:sub");
$stmTotal->bindParam(":stu", $row['id'], PDO::PARAM_STR);
$stmTotal->bindParam(":sub", $rowMark['id'], PDO::PARAM_STR);
$stmTotal->execute();
$total=0;
$rowCountTotal = $stmTotal->rowCount();
if($rowCountTotal > 0){
while($rowTotal = $stmTotal->fetch(PDO::FETCH_ASSOC)) {
$total=$total+$rowTotal['mark'];
}
}
echo "<td>".$total."</td>";
if ($total < 50) {
$result=0;
}
}
}
?>
<td>
<?php if($result==1){ ?>
<a class="btn btn-success btn-xs">دەرچووە</a>
<input type="hidden" name="stu[]" value="<?=$row['id'];?>" placeholder="">
<input type="hidden" name="res[]" value="1">
<?php }else{ ?>
<a class="btn btn-danger btn-xs">کەوتووە</a>
<input type="hidden" name="stu[]" value="<?=$row['id'];?>" placeholder="">
<input type="hidden" name="res[]" value="0">
<?php } ?>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<center>
<button type="submit" class="btn btn-success confirmation" name="save">گواستنەوەی خوێندکارە سەرکەوتووەکان لە قۆناغی <?=classwithString($cl);?> بۆ <?=classwithString($cl+1);?></button>
</center>
<?php
} }else {
} ?>
</form>
<div class="alert" role="alert" id="result"></div>
<?php include 'inc/foot.php'; ?>