Skip to content

Commit 4159ee6

Browse files
authored
Merge branch 'master' into week_list
2 parents ff21956 + 18824ed commit 4159ee6

File tree

506 files changed

+139107
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+139107
-17
lines changed

modules/manageheadbook/action_mysql.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_student;';
2121
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_school_year;';
2222
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_week;';
23+
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_program;';
24+
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_headbook;';
2325

2426
$sql_create_module = $sql_drop_module;
2527

@@ -67,7 +69,32 @@
6769
thoi_gian_bat_dau int(11) NOT NULL,
6870
thoi_gian_ket_thuc int(11) NOT NULL,
6971
PRIMARY KEY (ma_nam_hoc)
70-
) ENGINE=MyISAM;";
72+
) ENGINE=MyISAM;";
73+
74+
75+
$sql_create_module[] = "CREATE TABLE " . $db_config['prefix'] . "_" . $lang . "_" . $module_data . "_headbook (
76+
ma_so int(11) NOT NULL AUTO_INCREMENT,
77+
ma_tuan int(11) NOT NULL,
78+
ma_lop int(11) NOT NULL,
79+
ma_buoi int(1) NOT NULL,
80+
thu varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
81+
tiet int(1) NOT NULL,
82+
ma_mon int(11) NOT NULL,
83+
tiet_ppct int(11) NOT NULL,
84+
co_phep varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT 0,
85+
khong_phep varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT 0,
86+
di_muon varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT 0,
87+
ten_bai_hoc varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
88+
nhan_xet varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
89+
hoc_tap float NOT NULL,
90+
ky_luat float NOT NULL,
91+
ve_sinh float NOT NULL,
92+
tong_diem float NOT NULL,
93+
ki_ten varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
94+
ngay int(11) NOT NULL DEFAULT 0,
95+
PRIMARY KEY (ma_so)
96+
) ENGINE=MyISAM;";
97+
7198

7299
$sql_create_module[] = "CREATE TABLE " . $db_config['prefix'] . "_" . $lang . "_" . $module_data . "_week (
73100
ma_tuan int(11) NOT NULL AUTO_INCREMENT,
@@ -79,3 +106,15 @@
79106
trang_thai tinyint(1) NOT NULL DEFAULT 1,
80107
PRIMARY KEY (ma_tuan)
81108
) ENGINE=MyISAM;";
109+
110+
111+
$sql_create_module[] = "CREATE TABLE " . $db_config['prefix'] . "_" . $lang . "_" . $module_data . "_program (
112+
ma_chuong_trinh int(11) NOT NULL AUTO_INCREMENT,
113+
ma_nam_hoc int(11) DEFAULT NULL,
114+
ma_mon_hoc int(11) DEFAULT NULL,
115+
khoi int(2) NOT NULL,
116+
tiet int(5) NOT NULL,
117+
ten_bai_hoc varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
118+
PRIMARY KEY (ma_chuong_trinh)
119+
) ENGINE=MyISAM;";
120+

modules/manageheadbook/admin.functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
'schoolyearlist',
2727
'addyear',
2828
'addstudent',
29+
'program',
30+
'headbook',
2931
'weeklist',
3032
'editweek'
3133
];

modules/manageheadbook/admin.menu.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818

1919
$submenu['subject'] = $lang_module['subject'];
2020

21-
$submenu['schoolyearlist'] = $lang_module['school_year_list'];
21+
$submenu['schoolyearlist'] = $lang_module['school_year_list'];
22+
23+
$submenu['program'] = $lang_module['program'];
24+
25+
$submenu['headbook'] = $lang_module['head_book'];

modules/manageheadbook/admin/addsubject.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<?php
22

33
/**
4-
* @Project NUKEVIET 4.x
5-
* @Author VINADES.,JSC <contact@vinades.vn>
6-
* @Copyright (C) 2014 VINADES.,JSC. All rights reserved
7-
* @License GNU/GPL version 2 or any later version
8-
* @Createdate 24-06-2011 10:35
4+
* Headbook Management System
5+
* @version 4.x
6+
* @author Group DNTU
7+
* @license GNU/GPL version 3
8+
* @see https://github.com/phapdev/manage_headbook.git The Manage headbook GitHub project
99
*/
1010

11+
1112
if (!defined('NV_IS_FILE_ADMIN')) {
1213
die('Stop!!!');
1314
}
Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
<?php
2+
3+
/**
4+
* Headbook Management System
5+
* @version 4.x
6+
* @author Group DNTU
7+
* @license GNU/GPL version 3
8+
* @see https://github.com/phapdev/manage_headbook.git The Manage headbook GitHub project
9+
*/
10+
11+
if (!defined('NV_IS_FILE_ADMIN')) {
12+
exit('Stop!!!');
13+
}
14+
15+
$ma_nam_hoc_get = $nv_Request->get_int('manamhoc', 'post,get');
16+
$ma_tuan_get = $nv_Request->get_int('matuan', 'post,get');
17+
$ma_lop_get = $nv_Request->get_int('malop', 'post,get');
18+
$ma_buoi_get = $nv_Request->get_int('mabuoi', 'post,get');
19+
20+
21+
22+
$page_title = $lang_module['manage_headbook'];
23+
24+
$xtpl = new XTemplate('headbook.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
25+
$xtpl->assign('LANG', $lang_module);
26+
$xtpl->assign('GLANG', $lang_global);
27+
$xtpl->assign('NV_BASE_ADMINURL', NV_BASE_ADMINURL);
28+
$xtpl->assign('NV_NAME_VARIABLE', NV_NAME_VARIABLE);
29+
$xtpl->assign('NV_OP_VARIABLE', NV_OP_VARIABLE);
30+
$xtpl->assign('MODULE_NAME', $module_name);
31+
$xtpl->assign('OP', $op);
32+
33+
$xtpl->assign('MANAMHOC', $ma_nam_hoc_get);
34+
$xtpl->assign('MATUAN', $ma_tuan_get);
35+
$xtpl->assign('MALOP', $ma_lop_get);
36+
$xtpl->assign('MABUOI', $ma_buoi_get);
37+
38+
$display_form = 'style="display: none"';
39+
//nam hoc
40+
41+
if($nv_Request->isset_request("change_schoolyear","post,get")) {
42+
$manamhoc = $nv_Request->get_int('manamhoc','get',0);
43+
// Subject
44+
if ($manamhoc > 0) {
45+
$queryweek = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_week WHERE ma_nam_hoc='.$manamhoc.' ORDER BY tu_ngay ASC');
46+
$html = '';
47+
while ($row = $queryweek->fetch()) {
48+
$html .= '<option value="' . $row['ma_tuan'] . '">' . $row['ten_tuan'].' ('.nv_date('d/m/Y', $row['tu_ngay']). ' - '.nv_date('d/m/Y', $row['den_ngay']).')' . '</option>';
49+
}
50+
die($html);
51+
} else {
52+
die("ERR");
53+
}
54+
}
55+
56+
// năm học
57+
$queryschoolyear = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_school_year ORDER BY tu_nam ASC');
58+
59+
$selectedschoolyear=$ma_nam_hoc_get ? $ma_nam_hoc_get : 0;
60+
$arrayschoolyear = [];
61+
while ($row = $queryschoolyear->fetch()) {
62+
$arrayschoolyear[$row['ma_nam_hoc']] = $row;
63+
}
64+
65+
// hien thi du lieu hocsinh
66+
if(!empty($arrayschoolyear)) {
67+
foreach ($arrayschoolyear as $value) {
68+
$value['key'] = $value['ma_nam_hoc'];
69+
$value['title'] = $value['tu_nam'] . ' - ' . $value['den_nam'];
70+
$value['selected'] = $selectedschoolyear == $value['ma_nam_hoc'] ? "selected" : "";
71+
$xtpl->assign('DATA_SCHOOLYEAR', $value);
72+
$xtpl->parse('headbook.loopschoolyear');
73+
}
74+
}
75+
76+
// lop
77+
$queryclass = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_class ORDER BY ten_lop ASC');
78+
79+
$selectedclass= $ma_lop_get ? $ma_lop_get : 0;
80+
$arrayclass = [];
81+
while ($row = $queryclass->fetch()) {
82+
$arrayclass[$row['ma_lop']] = $row;
83+
}
84+
85+
// hien thi du lieu hocsinh
86+
if(!empty($arrayclass)) {
87+
foreach ($arrayclass as $value) {
88+
$value['key'] = $value['ma_lop'];
89+
$value['title'] = $value['ten_lop'];
90+
$value['selected'] = $selectedclass == $value['ma_lop'] ? "selected" : "";
91+
$xtpl->assign('DATA_CLASS', $value);
92+
$xtpl->parse('headbook.loopclass');
93+
}
94+
}
95+
96+
$selectedday = $ma_buoi_get ? $ma_buoi_get : 0;
97+
$data=[];
98+
for ($i=1; $i <=2 ; $i++) {
99+
$data['key'] = $i;
100+
$data['title'] = $lang_module['daystatus'.$i];
101+
$data['selected'] = $selectedday == $i ? "selected" : "";
102+
$xtpl->assign('DATA_DAYSTUS', $data);
103+
$xtpl->parse('headbook.loopdaystatus');
104+
}
105+
106+
// tuan
107+
if($ma_tuan_get) {
108+
$queryweek = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_week WHERE ma_nam_hoc ='.$ma_nam_hoc_get .' ORDER BY tu_ngay ASC');
109+
// o day phai doi tim duoc hoc sinh nghi
110+
$selectedweek=$ma_tuan_get;
111+
$arrayweek = [];
112+
while ($row = $queryweek->fetch()) {
113+
$arrayweek[$row['ma_tuan']] = $row;
114+
}
115+
116+
// hien thi du lieu hocsinh
117+
if(!empty($arrayweek)) {
118+
foreach ($arrayweek as $value) {
119+
$value['key'] = $value['ma_tuan'];
120+
$value['title'] = $value['ten_tuan'] .' ('.nv_date('d/m/Y', $value['tu_ngay']). ' - '.nv_date('d/m/Y', $value['den_ngay']).')';
121+
$value['selected'] = $selectedweek == $value['ma_tuan'] ? "selected" : "";
122+
123+
$xtpl->assign('DATA_WEEK', $value);
124+
$xtpl->parse('headbook.loopweek');
125+
}
126+
}
127+
}
128+
129+
$querytungay = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_week WHERE ma_nam_hoc ='.$ma_nam_hoc_get . ' AND ma_tuan='.$ma_tuan_get);
130+
131+
$datatungay = $querytungay->fetch();
132+
$currenttime = $datatungay['tu_ngay'];
133+
// cho nay lay trang thai tuan do
134+
135+
136+
137+
if($ma_nam_hoc_get > 0 && $ma_lop_get > 0 && $ma_buoi_get >0 && $ma_tuan_get >0) {
138+
if($datatungay['trang_thai'] == 1) {
139+
$xtpl->assign('DISPLAY_INFO', 'style="display:none"');
140+
$xtpl->assign('DISPLAY_FUNC_TITLE', '');
141+
$xtpl->assign('DISPLAY_FUNC', '');
142+
} else {
143+
$xtpl->assign('DISPLAY_INFO', '');
144+
$xtpl->assign('DISPLAY_FUNC_TITLE', 'display:none;');
145+
$xtpl->assign('DISPLAY_FUNC', 'style="display:none;"');
146+
}
147+
for ($i=2; $i <= 8; $i++){
148+
$array = [];
149+
// Gọi csdl để lấy dữ liệu
150+
$query = $db->query("SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_headbook WHERE ma_tuan=".$ma_tuan_get." AND ma_lop=".$ma_lop_get." AND ma_buoi=".$ma_buoi_get." AND thu LIKE 'Th%". $i ."' ORDER BY tiet ASC");
151+
// đổ dữ liệu
152+
while ($row = $query->fetch()) {
153+
$array[$row['tiet']] = $row;
154+
}
155+
156+
if ($array) {
157+
for ($j = 1; $j <= 5; $j++) {
158+
$value = $array[$j];
159+
$day = '';
160+
if ($j == 1) {
161+
$day = '<td rowspan="5" align="center" style="vertical-align:middle; font-weight:600">'. $lang_module['day'.$i] .'<br />'.nv_date('d/m/Y',$currenttime).'</td>';
162+
}
163+
if ($value) {
164+
$value['checksess'] = md5($value['ma_so'] . NV_CHECK_SESSION);
165+
$value['edit_url'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addheadbook&manamhoc='.$ma_nam_hoc_get.'&matuan=' . $ma_tuan_get . '&malop='.$ma_lop_get. '&mabuoi='.$ma_buoi_get. '&thu='.$i . '&tiet='.$value['tiet'] . '&id='.$value['ma_so'];
166+
167+
// lay ra mon hoc
168+
$querysubject = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_subject WHERE ma_mon_hoc=' . $value['ma_mon']);
169+
$datasubject = $querysubject->fetch();
170+
$value['ten_mon_hoc'] = $datasubject['ten_mon_hoc'];
171+
172+
// chuyen thanh array
173+
$arrabsent1 = explode(",", $value['co_phep']);
174+
$arrabsent2 = explode(",", $value['khong_phep']);
175+
$value['tenhocsinhnghi'] = '';
176+
// lay ra may thang nghi
177+
if ($arrabsent1[0] != 0) {
178+
$last_key1 = end(array_keys($arrabsent1));
179+
foreach ($arrabsent1 as $key => $mahocsinh) {
180+
// die('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_studentlist WHERE maHocSinh=' . $mahocsinh);
181+
$queryabsent = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_student WHERE ma_hoc_sinh=' . $mahocsinh);
182+
$dataabsent = $queryabsent->fetch();
183+
if ($key == $last_key1) {
184+
$value['tenhocsinhnghi'] .= $dataabsent['ho_ten'] . ': CP';
185+
} else {
186+
$value['tenhocsinhnghi'] .= $dataabsent['ho_ten'] . ', ';
187+
}
188+
}
189+
}
190+
191+
if ($arrabsent2[0] != '') {
192+
if ($arrabsent1[0] != '')
193+
$value['tenhocsinhnghi'] .= ', ';
194+
$last_key2 = end(array_keys($arrabsent2));
195+
foreach ($arrabsent2 as $key => $mahocsinh) {
196+
// die('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_studentlist WHERE maHocSinh=' . $mahocsinh);
197+
$queryabsent = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_student WHERE ma_hoc_sinh=' . $mahocsinh);
198+
$dataabsent = $queryabsent->fetch();
199+
if ($key == $last_key2) {
200+
$value['tenhocsinhnghi'] .= $dataabsent['ho_ten'] . ': K';
201+
} else {
202+
$value['tenhocsinhnghi'] .= $dataabsent['ho_ten'] . ', ';
203+
}
204+
}
205+
}
206+
207+
208+
// lay di may thang di hoc mon
209+
210+
$arrlate = explode(",", $value['di_muon']);
211+
$value['tenhocsinhdi_muon'] = '';
212+
if($arrlate[0] != '') {
213+
$last_key3 = end(array_keys($arrlate));
214+
foreach ($arrlate as $key => $mahocsinh) {
215+
// die('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_studentlist WHERE maHocSinh=' . $mahocsinh);
216+
$querylate = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_studentlist WHERE maHocSinh=' . $mahocsinh);
217+
$datalate = $querylate->fetch();
218+
if ($key == $last_key3) {
219+
$value['tenhocsinhdi_muon'] .= $datalate['ho_ten'];
220+
} else {
221+
$value['tenhocsinhdi_muon'] .= $datalate['ho_ten'] . ', ';
222+
}
223+
}
224+
}
225+
226+
227+
$xtpl->assign('DISPLAY_ADD', 'none');
228+
$xtpl->assign('DISPLAY_EDIT', 'block');
229+
230+
$xtpl->assign('DISPLAY_ADD', 'none');
231+
$xtpl->assign('DISPLAY_EDIT', 'block');
232+
$xtpl->assign('DISPLAY_IMG', 'block');
233+
} else {
234+
235+
$value['add_url'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addheadbook&ma_nam_hoc='.$ma_nam_hoc_get.'&ma_tuan='.$ma_tuan_get.'&ma_lop='.$ma_lop_get.'&ma_buoi='.$ma_buoi_get.'&thu='.$i . '&tiet='.$j;
236+
$xtpl->assign('DISPLAY_ADD', 'block');
237+
$xtpl->assign('DISPLAY_EDIT', 'none');
238+
$xtpl->assign('DISPLAY_IMG', 'none');
239+
}
240+
$xtpl->assign('DATA', $value);
241+
$xtpl->assign('DAY', $day);
242+
$xtpl->assign('LESSON', $j);
243+
244+
$xtpl->parse('headbook.loopday.looplesson');
245+
}
246+
247+
} else {
248+
for ($j=1; $j <= 5; $j++) {
249+
$day = '';
250+
$value = [];
251+
if ($j== 1) {
252+
$day = '<td rowspan="5" align="center" style="vertical-align:middle;font-weight:600">'. $lang_module['day'.$i] .'<br />'.nv_date('d/m/Y',$currenttime).'</td>';
253+
}
254+
$value['add_url'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addheadbook&ma_nam_hoc='.$ma_nam_hoc_get.'&ma_tuan='.$ma_tuan_get.'&ma_lop='.$ma_lop_get.'&ma_buoi='.$ma_buoi_get.'&thu='.$i . '&tiet='.$j;
255+
256+
$xtpl->assign('DATA', $value);
257+
$xtpl->assign('DAY', $day);
258+
$xtpl->assign('LESSON', $j);
259+
$xtpl->assign('DISPLAY_ADD', 'block');
260+
$xtpl->assign('DISPLAY_IMG', 'none');
261+
$xtpl->assign('DISPLAY_EDIT', 'none');
262+
263+
$xtpl->parse('headbook.loopday.looplesson');
264+
}
265+
}
266+
$xtpl->parse('headbook.loopday');
267+
$currenttime += 86400;
268+
}
269+
$display_form = '';
270+
}
271+
else {
272+
$xtpl->assign('DISPLAY_INFO', 'style="display:none"');
273+
}
274+
275+
$xtpl->assign('DISPLAY_FORM', $display_form);
276+
277+
$xtpl->parse('headbook');
278+
$contents = $xtpl->text('headbook');
279+
280+
include NV_ROOTDIR . '/includes/header.php';
281+
echo nv_admin_theme($contents);
282+
include NV_ROOTDIR . '/includes/footer.php';

0 commit comments

Comments
 (0)