Skip to content

Commit fc56175

Browse files
committed
Merge branch 'master' into show_delete_student
2 parents 4971af5 + f2fd056 commit fc56175

File tree

13 files changed

+375
-6
lines changed

13 files changed

+375
-6
lines changed

modules/manageheadbook/action_mysql.php

100755100644
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,24 @@
1313
}
1414

1515
$sql_drop_module = [];
16-
16+
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . ';';
17+
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_school_info;';
1718
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_class;';
19+
$sql_drop_module[] = 'DROP TABLE IF EXISTS ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . '_subject;';
1820

1921
$sql_create_module = $sql_drop_module;
2022

23+
24+
$sql_create_module[] = 'CREATE TABLE ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . "_school_info(
25+
id int(11) NOT NULL AUTO_INCREMENT,
26+
ten_so varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
27+
ten_phong varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
28+
ten_truong varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
29+
tu_nam int(11) NOT NULL DEFAULT 0,
30+
den_nam int(11) NOT NULL DEFAULT 0,
31+
PRIMARY KEY (id)
32+
) ENGINE=MyISAM";
33+
2134
$sql_create_module[] = "CREATE TABLE " . $db_config['prefix'] . "_" . $lang . "_" . $module_data . "_class (
2235
ma_lop int(11) NOT NULL AUTO_INCREMENT,
2336
ma_gvcn int(11) DEFAULT NULL,
@@ -37,3 +50,9 @@
3750
anh_dai_dien varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
3851
PRIMARY KEY (ma_hoc_sinh)
3952
) ENGINE=MyISAM;";
53+
54+
$sql_create_module[] = 'CREATE TABLE ' . $db_config['prefix'] . '_' . $lang . '_' . $module_data . "_subject (
55+
ma_mon_hoc int(11) NOT NULL AUTO_INCREMENT,
56+
ten_mon_hoc varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
57+
PRIMARY KEY (ma_mon_hoc)
58+
) ENGINE=MyISAM";

modules/manageheadbook/admin.functions.php

100755100644
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@
1414

1515
$allow_func = [
1616
'main',
17+
'school_info',
1718
'addclass',
1819
'class',
1920
'delclass',
2021
'student',
22+
'delstudent',
23+
'subject',
24+
'addsubject',
25+
'delsubject'
2126
// 'addstudent',
22-
'delstudent'
2327
];
2428

2529
define('NV_IS_FILE_ADMIN', true);

modules/manageheadbook/admin.menu.php

100755100644
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
exit('Stop!!!');
1313
}
1414

15-
$submenu['class'] = $lang_module['class'];
15+
$submenu['school_info'] = $lang_module['school_info'];
1616

17+
$submenu['class'] = $lang_module['class'];
1718

19+
$submenu['subject'] = $lang_module['subject'];
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
3+
/**
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
9+
*/
10+
11+
if (!defined('NV_IS_FILE_ADMIN')) {
12+
die('Stop!!!');
13+
}
14+
15+
$subjectid = $nv_Request->get_int('subjectid', 'post,get');
16+
17+
$xtpl = new XTemplate('addsubject.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
18+
$xtpl->assign('LANG', $lang_module);
19+
$xtpl->assign('GLANG', $lang_global);
20+
21+
if ($subjectid) {
22+
// chinh sua
23+
$page_title = $lang_module['edit_subject'];
24+
$querysubject = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_subject WHERE ma_mon_hoc = ' . $subjectid);
25+
$subject = $querysubject->fetch();
26+
if($subject) {
27+
$xtpl->assign('DATA', $subject);
28+
}
29+
$row = [];
30+
if ($nv_Request->isset_request('btnsubmit', 'post')) {
31+
$row['ten_mon_hoc'] = nv_substr($nv_Request->get_title('ten_mon_hoc', 'post', ''), 0, 250);
32+
//Xu ly luu du lieu
33+
$_sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_subject SET ten_mon_hoc=:ten_mon_hoc WHERE ma_mon_hoc=' . $subjectid;
34+
$sth = $db->prepare($_sql);
35+
$sth->bindParam(':ten_mon_hoc', $row['ten_mon_hoc'], PDO::PARAM_STR);
36+
$exe = $sth->execute();
37+
38+
if ($exe) {
39+
nv_redirect_location(NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=subject');
40+
}
41+
}
42+
} else {
43+
// Thêm mới
44+
$page_title = $lang_module['add_subject'];
45+
$i = 0;
46+
$row = [];
47+
if ($nv_Request->isset_request('btnsubmit', 'post')) {
48+
$row['ten_mon_hoc'] = nv_substr($nv_Request->get_title('ten_mon_hoc', 'post', ''), 0, 250);
49+
//Xu ly luu du lieu
50+
$_sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_subject (
51+
ten_mon_hoc) VALUES (:ten_mon_hoc)';
52+
$sth = $db->prepare($_sql);
53+
$sth->bindParam(':ten_mon_hoc', $row['ten_mon_hoc'], PDO::PARAM_STR);
54+
$exe = $sth->execute();
55+
56+
if ($exe) {
57+
nv_redirect_location(NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=subject');
58+
}
59+
}
60+
61+
}
62+
63+
$xtpl->parse('addsubject');
64+
$contents = $xtpl->text('addsubject');
65+
66+
include NV_ROOTDIR . '/includes/header.php';
67+
echo nv_admin_theme($contents);
68+
include NV_ROOTDIR . '/includes/footer.php';
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
die('Stop!!!');
13+
}
14+
15+
if (! defined('NV_IS_AJAX')) {
16+
die('Wrong URL');
17+
}
18+
19+
$checkss = $nv_Request->get_string('checkss', 'post');
20+
$ma_mon_hoc = $nv_Request->get_int('ma_mon_hoc', 'post', 0);
21+
$contents = '';
22+
23+
if ($ma_mon_hoc > 0) {
24+
nv_insert_logs(NV_LANG_DATA, $module_name, 'log_delsubject', "ma_mon_hoc " . $ma_mon_hoc, $admin_info['userid']);
25+
$sql ='DELETE FROM ' . NV_PREFIXLANG . '_' . $module_data . '_subject WHERE ma_mon_hoc=' . $ma_mon_hoc;
26+
if ($db->exec($sql)) {
27+
$nv_Cache->delMod($module_name);
28+
$contents = "OK_" . $ma_mon_hoc;
29+
} else {
30+
$contents = "ERR_" . $lang_module['subject_delete_unsuccess'];
31+
}
32+
}
33+
34+
include NV_ROOTDIR . '/includes/header.php';
35+
echo $contents;
36+
include NV_ROOTDIR . '/includes/footer.php';

modules/manageheadbook/admin/main.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
exit('Stop!!!');
1313
}
1414

15-
$page_title = $lang_module[''];
15+
$page_title = $lang_module['head_book'];
1616

1717

1818
include NV_ROOTDIR . '/includes/header.php';
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
$page_title = $lang_module['school_info'];
16+
17+
18+
// Gọi csdl để lấy dữ liệu
19+
$query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_school_info');
20+
$data = $query->fetch();
21+
22+
$xtpl = new XTemplate('school_info.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
23+
$xtpl->assign('LANG', $lang_module);
24+
$row = [];
25+
26+
if ($nv_Request->isset_request('btnsubmit', 'post')) {
27+
$row['ten_so'] = nv_substr($nv_Request->get_title('ten_so', 'post', ''), 0, 250);
28+
$row['ten_phong'] = nv_substr($nv_Request->get_title('ten_phong', 'post', ''), 0, 250);
29+
$row['ten_truong'] = nv_substr($nv_Request->get_title('ten_truong', 'post', ''), 0, 250);
30+
$row['tu_nam'] = $nv_Request->get_int('tu_nam', 'post', '');
31+
$row['den_nam'] = $nv_Request->get_int('den_nam', 'post', '');
32+
33+
if (!$data) {
34+
//them moi
35+
$_sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_school_info (
36+
ten_so, ten_phong, ten_truong, tu_nam, den_nam) VALUES (
37+
:ten_so, :ten_phong, :ten_truong, :tu_nam, :den_nam)';
38+
39+
$sth = $db->prepare($_sql);
40+
$sth->bindParam(':ten_so', $row['ten_so'], PDO::PARAM_STR);
41+
$sth->bindParam(':ten_phong', $row['ten_phong'], PDO::PARAM_STR);
42+
$sth->bindParam(':ten_truong', $row['ten_truong'], PDO::PARAM_STR);
43+
$sth->bindParam(':tu_nam', $row['tu_nam'], PDO::PARAM_STR);
44+
$sth->bindParam(':den_nam', $row['den_nam'], PDO::PARAM_STR);
45+
$exe = $sth->execute();
46+
47+
if ($exe) {
48+
nv_redirect_location(NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op);
49+
}
50+
} else {
51+
$_sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_school_info
52+
SET ten_so = :ten_so, ten_phong = :ten_phong, ten_truong = :ten_truong, tu_nam = :tu_nam, den_nam = :den_nam
53+
WHERE id = '. $data['id'];
54+
55+
// die($_sql);
56+
$sth = $db->prepare($_sql);
57+
$sth->bindParam(':ten_so', $row['ten_so'], PDO::PARAM_STR);
58+
$sth->bindParam(':ten_phong', $row['ten_phong'], PDO::PARAM_STR);
59+
$sth->bindParam(':ten_truong', $row['ten_truong'], PDO::PARAM_STR);
60+
$sth->bindParam(':tu_nam', $row['tu_nam'], PDO::PARAM_STR);
61+
$sth->bindParam(':den_nam', $row['den_nam'], PDO::PARAM_STR);
62+
$exe = $sth->execute();
63+
64+
if ($exe) {
65+
nv_redirect_location(NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op);
66+
}
67+
}
68+
69+
}
70+
if($data){
71+
$xtpl->assign('DATA', $data);
72+
}
73+
74+
75+
$xtpl->parse('school_info');
76+
$contents = $xtpl->text('school_info');
77+
include NV_ROOTDIR . '/includes/header.php';
78+
echo nv_admin_theme($contents);
79+
include NV_ROOTDIR . '/includes/footer.php';
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
/**
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
9+
*/
10+
11+
if (!defined('NV_IS_FILE_ADMIN')) {
12+
die('Stop!!!');
13+
}
14+
15+
$page_title = $lang_module['subject'];
16+
$page_addsubject = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addsubject';
17+
$array = [];
18+
19+
// Gọi csdl để lấy dữ liệu
20+
$querysubject = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_subject');
21+
22+
// Đổ dữ liệu
23+
while ($row = $querysubject->fetch()) {
24+
$array[$row['ma_mon_hoc']] = $row;
25+
}
26+
27+
$xtpl = new XTemplate('subject.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
28+
$xtpl->assign('LANG', $lang_module);
29+
$xtpl->assign('GLANG', $lang_global);
30+
$xtpl->assign('PAGE_ADDSUBJECT', $page_addsubject);
31+
32+
// hien thi du lieu
33+
if($array) {
34+
foreach ($array as $value) {
35+
$value['url_edit'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addsubject&subjectid=' . $value['ma_mon_hoc'];
36+
$xtpl->assign('DATA', $value);
37+
$xtpl->parse('subject.loop');
38+
}
39+
}
40+
41+
$xtpl->parse('subject');
42+
$contents = $xtpl->text('subject');
43+
44+
include NV_ROOTDIR . '/includes/header.php';
45+
echo nv_admin_theme($contents);
46+
include NV_ROOTDIR . '/includes/footer.php';

modules/manageheadbook/language/admin_vi.php

100755100644
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,16 @@
4949

5050

5151

52+
$lang_module['head_book'] = 'Sổ đầu bài';
53+
$lang_module['school_info'] = 'Thông tin trường học';
54+
$lang_module['department_name'] = 'Tên sở';
55+
$lang_module['room_name'] = 'Tên phòng';
56+
$lang_module['school_name'] = 'Tên trường';
57+
$lang_module['school_year'] = 'Năm học';
58+
$lang_module['save'] = 'Lưu thay đổi';
59+
60+
$lang_module['subject'] = 'Môn học';
61+
$lang_module['add_subject'] = 'Thêm môn học';
62+
$lang_module['edit_subject'] = 'Sửa môn học';
63+
$lang_module['subject_id'] = 'Mã môn học';
64+
$lang_module['subject_name'] = 'Tên môn học';

themes/admin_default/js/manageheadbook.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ function nv_del_student(ma_hoc_sinh, ma_lop, checkss) {
2020
var r_split = res.split("_");
2121
if (r_split[0] == 'OK') {
2222
window.location.href = script_name + '?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=studentlist&classlistid=' + ma_lop;
23+
}
24+
});
25+
}
26+
}
27+
function nv_del_subject(ma_mon_hoc, checkss) {
28+
if (confirm(nv_is_del_confirm[0])) {
29+
$.post(script_name + '?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=delsubject&nocache=' + new Date().getTime(), 'ma_mon_hoc=' + ma_mon_hoc + '&checkss=' + checkss, function(res) {
30+
var r_split = res.split("_");
31+
if (r_split[0] == 'OK') {
32+
window.location.href = script_name + '?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=subject';
33+
2334
} else if (r_split[0] == 'ERR') {
2435
alert(r_split[1]);
2536
} else {
@@ -29,5 +40,3 @@ function nv_del_student(ma_hoc_sinh, ma_lop, checkss) {
2940
}
3041
return false;
3142
}
32-
33-

0 commit comments

Comments
 (0)