Skip to content

Commit ff21956

Browse files
committed
create week list
1 parent 94fb43f commit ff21956

File tree

9 files changed

+204
-8
lines changed

9 files changed

+204
-8
lines changed

modules/manageheadbook/admin.functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
'delsubject',
2626
'schoolyearlist',
2727
'addyear',
28-
'addstudent'
28+
'addstudent',
29+
'weeklist',
30+
'editweek'
2931
];
3032

3133
define('NV_IS_FILE_ADMIN', true);

modules/manageheadbook/admin/addyear.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
$query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_school_year WHERE tu_nam='. $row['tu_nam'] .' AND den_nam=' . $row['den_nam'].' AND thoi_gian_bat_dau=' . $row['thoi_gian_bat_dau'] .' AND thoi_gian_ket_thuc=' . $row['thoi_gian_ket_thuc']);
6464

6565
// đổ dữ liệu
66-
$dataschoolyear = $query->fetch();
66+
$data_school_year = $query->fetch();
6767

6868

6969
$time_per_week = 86400 * 7;
@@ -87,9 +87,9 @@
8787
$den_ngay = $time_from_day + $i * $time_per_week + $time_per_week - $time_per_1day;
8888
$ten_tuan ='Tuần ' . ($i+1);
8989
if ($sum_time > $time_to_day)
90-
$_sqlweek = $_sqlweek . " (". $dataschoolyear['ma_nam_hoc'].", ".$tu_ngay.", ".$den_ngay.", '".$ten_tuan."');";
90+
$_sqlweek = $_sqlweek . " (". $data_school_year['ma_nam_hoc'].", ".$tu_ngay.", ".$den_ngay.", '".$ten_tuan."');";
9191
else
92-
$_sqlweek = $_sqlweek . " (". $dataschoolyear['ma_nam_hoc'].", ".$tu_ngay.", ".$den_ngay.", '".$ten_tuan."'),";
92+
$_sqlweek = $_sqlweek . " (". $data_school_year['ma_nam_hoc'].", ".$tu_ngay.", ".$den_ngay.", '".$ten_tuan."'),";
9393
}
9494
// die($_sqlweek);
9595
$db->query($_sqlweek);
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
/**
3+
* Headbook Management System
4+
* @version 4.x
5+
* @author Group DNTU
6+
* @license GNU/GPL version 3
7+
* @see https://github.com/phapdev/manage_headbook.git The Manage headbook GitHub project
8+
*/
9+
if (!defined('NV_IS_FILE_ADMIN')) {
10+
die('Stop!!!');
11+
}
12+
$page_title = $lang_module['edit_week'];
13+
14+
//lay id post
15+
$weekid = $nv_Request->get_int('weekid', 'post,get');
16+
$schoolyearid = $nv_Request->get_int('schoolyearid', 'post,get');
17+
18+
$xtpl = new XTemplate('editweek.tpl', NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $module_file);
19+
$xtpl->assign('LANG', $lang_module);
20+
$xtpl->assign('GLANG', $lang_global);
21+
22+
if ($weekid) {
23+
// chinh sua
24+
$queryweek = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_week WHERE ma_tuan = ' . $weekid);
25+
$week = $queryweek->fetch();
26+
if($week) {
27+
$xtpl->assign('DATA', $week);
28+
}
29+
$row = [];
30+
if ($nv_Request->isset_request('btnsubmit', 'post')) {
31+
$row['mo_ta'] = nv_substr($nv_Request->get_title('mo_ta', 'post', ''), 0, 250);
32+
//Xu ly luu du lieu
33+
$_sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_week SET mo_ta=:mo_ta WHERE ma_tuan=' . $weekid;
34+
$sth = $db->prepare($_sql);
35+
$sth->bindParam(':mo_ta', $row['mo_ta'], 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 . '=weeklist&schoolyearid='.$schoolyearid);
40+
}
41+
}
42+
}
43+
44+
45+
$xtpl->parse('editweek');
46+
$contents = $xtpl->text('editweek');
47+
48+
include NV_ROOTDIR . '/includes/header.php';
49+
echo nv_admin_theme($contents);
50+
include NV_ROOTDIR . '/includes/footer.php';

modules/manageheadbook/admin/schoolyearlist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
$page_title = $lang_module['school_year_list'];
1414
$page_addschoolyear = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=addyear';
15-
$page_studentlist = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=studentlist';
15+
$page_studentlist = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=weeklist';
1616
$array = [];
1717

1818
//get data
@@ -31,7 +31,7 @@
3131
// hien thi du lieu
3232
if(!empty($array)) {
3333
foreach ($array as $value) {
34-
$value['url_week_list'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE .'=weeklist&id=' . $value['ma_nam_hoc'] ;
34+
$value['url_week_list'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE .'=weeklist&schoolyearid=' . $value['ma_nam_hoc'] ;
3535
$value['checksess'] = md5($value['ma_nam_hoc'] . NV_CHECK_SESSION);
3636
$value['thoi_gian_bat_dau'] = nv_date('d/m/Y', $value['thoi_gian_bat_dau']);
3737
$value['thoi_gian_ket_thuc'] = nv_date('d/m/Y', $value['thoi_gian_ket_thuc']);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
/**
3+
* Headbook Management System
4+
* @version 4.x
5+
* @author Group DNTU
6+
* @license GNU/GPL version 3
7+
* @see https://github.com/phapdev/manage_headbook.git The Manage headbook GitHub project
8+
*/
9+
10+
if (!defined('NV_IS_FILE_ADMIN')) {
11+
die('Stop!!!');
12+
}
13+
14+
15+
$page_title = $lang_module['week_list'];
16+
17+
$xtpl = new XTemplate('weeklist.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+
22+
$schoolyearid = $nv_Request->get_int('schoolyearid', 'post,get');
23+
// lay du lieu
24+
$query = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_week WHERE ma_nam_hoc='.$schoolyearid. ' ORDER BY tu_ngay ASC');
25+
26+
// Đổ dữ liệu
27+
$namhocid;
28+
while ($row = $query->fetch()) {
29+
$array[$row['ma_tuan']] = $row;
30+
$namhocid = $row['ma_nam_hoc'];
31+
}
32+
33+
$querynamhoc = $db->query('SELECT * FROM ' . NV_PREFIXLANG . '_' . $module_data . '_school_year WHERE ma_nam_hoc='.$namhocid);
34+
$datanamhoc = $querynamhoc->fetch();
35+
36+
// hien thi du lieu s
37+
if($array) {
38+
39+
foreach ($array as $value) {
40+
$value['url_edit'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=editweek&schoolyearid='.$value['ma_nam_hoc'].'&weekid=' . $value['ma_tuan'];
41+
$value['nam_hoc'] = $datanamhoc['tu_nam'].' - '.$datanamhoc['den_nam'];
42+
$value['tu_ngay'] = nv_date('d/m/Y', $value['tu_ngay']);
43+
$value['den_ngay'] = nv_date('d/m/Y', $value['den_ngay']);
44+
$value['active'] = $value['trang_thai'] == 1 ? 'checked' : '';
45+
$value['icon'] = $value['mo_ta'] ? "edit" : "plus";
46+
$xtpl->assign('DATA', $value);
47+
$xtpl->parse('weeklist.loop');
48+
}
49+
}
50+
51+
$xtpl->parse('weeklist');
52+
$contents = $xtpl->text('weeklist');
53+
54+
include NV_ROOTDIR . '/includes/header.php';
55+
echo nv_admin_theme($contents);
56+
include NV_ROOTDIR . '/includes/footer.php';

modules/manageheadbook/language/admin_vi.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
$lang_module['func'] = 'Chức năng';
1818
$lang_module['add'] = 'Thêm mới';
19+
$lang_module['desc'] = 'Mô tả';
1920

2021
$lang_module['addclass'] = 'Thêm lớp';
2122
$lang_module['class'] = 'Lớp học';
@@ -74,4 +75,10 @@
7475
$lang_module['week_list'] = 'Danh sách tuần';
7576
$lang_module['start_time'] = 'Thời gian bắt đầu (dự kiến)';
7677
$lang_module['finish_time'] = 'Thời gian kết thúc (dự kiến)';
77-
$lang_module['add_year_title'] = 'Thêm năm học';
78+
$lang_module['add_year_title'] = 'Thêm năm học';
79+
80+
$lang_module['week_name'] = 'Tên tuần';
81+
$lang_module['from_day'] = 'Từ ngày';
82+
$lang_module['to_day'] = 'Đến ngày ';
83+
$lang_module['desc'] = 'Mô tả';
84+
$lang_module['validate'] = 'Hiệu lực';

themes/admin_default/modules/manageheadbook/addyear.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<td>{LANG.start_time} <span class="red">*</span></td>
2222
<td>
2323
<span class="text-middle">
24-
<input class="form-control" name="thoi_gian_batdau" id="starttime" value="{DATA.thoi_gian_bat_dau}" style="width: 100px;" maxlength="10" type="text" />
24+
<input class="form-control" name="thoi_gian_bat_dau" id="starttime" value="{DATA.thoi_gian_bat_dau}" style="width: 100px;" maxlength="10" type="text" />
2525
</span>
2626
</td>
2727
</tr>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- BEGIN: editweek -->
2+
<link rel="stylesheet" type="text/css" href="{NV_BASE_SITEURL}{NV_ASSETS_DIR}/js/jquery-ui/jquery-ui.min.css">
3+
4+
<div id="edit">
5+
<!-- BEGIN: error -->
6+
<div class="alert alert-danger">
7+
{error}
8+
</div>
9+
<!-- END: error -->
10+
11+
<form action="" method="post">
12+
<table class="table table-striped table-bordered table-hover">
13+
<tbody>
14+
<tr>
15+
<td>{LANG.desc} <span class="red">*</span></td>
16+
<td>
17+
<input class="form-control w400" name="mota" type="text" value="{DATA.mota}" maxlength="255" />
18+
</td>
19+
</tr>
20+
</tbody>
21+
</table>
22+
<div class="text-center">
23+
<input class="btn btn-primary" type="submit" name="btnsubmit" value="{LANG.save}">
24+
</div>
25+
</form>
26+
</div>
27+
<!-- END: editweek -->
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!-- BEGIN: weeklist -->
2+
<div class="table-responsive">
3+
<table class="table table-striped table-bordered table-hover">
4+
<thead>
5+
<tr>
6+
<th class="text-center">{LANG.week_name}</th>
7+
<th class="text-center">{LANG.from_day}</th>
8+
<th class="text-center">{LANG.to_day}</th>
9+
<th class="text-center">{LANG.school_year}</th>
10+
<th class="w250 text-center">{LANG.desc}</th>
11+
<th class="text-center">{LANG.validate}</th>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
<!-- BEGIN: loop -->
16+
<tr>
17+
<td class=text-center>{DATA.ten_tuan}</td>
18+
<td class=text-center>{DATA.tu_ngay}</td>
19+
<td class=text-center>{DATA.den_ngay}</td>
20+
<td class=text-center>{DATA.nam_hoc}</td>
21+
<td class=text-center>
22+
{DATA.mo_ta}
23+
<a href="{DATA.url_edit}" class="btn btn-default btn-xs" ><i class="fa fa-fw fa-{DATA.icon}"></i></a>
24+
</td>
25+
<td class="text-center">
26+
<input type="checkbox" name="activecheckbox" id="change_active_week_{DATA.matuan}" onclick="nv_change_active_week1('{DATA.matuan}')" {DATA.active}>
27+
</td>
28+
</tr>
29+
<!-- END: loop -->
30+
</tbody>
31+
</table>
32+
</div>
33+
<script>
34+
function nv_change_active_week1(matuan) {
35+
var new_status = $('#change_active_week_'+matuan).is(':checked') ? 1 : 0;
36+
if (confirm(nv_is_change_act_confirm[0])) {
37+
nv_settimeout_disable('change_active_week_'+matuan, 3000);
38+
$.post(script_name + '?' + nv_lang_variable + '=' + nv_lang_data + '&' + nv_name_variable + '=' + nv_module_name + '&' + nv_fc_variable + '=change_active&nocache=' + new Date().getTime(), 'change_active=1&matuan=' + matuan + '&new_status=' + new_status, function(res) {
39+
if(res == 'OK') {
40+
alert('Mở/khóa tuần thành công !!!');
41+
42+
} else {
43+
alert(res);
44+
$('#change_active_week_'+matuan).prop('checked', new_status == 1 ? 'true' : 'false');
45+
46+
}
47+
});
48+
} else {
49+
$('#change_active_week_'+matuan).prop('checked', new_status == 1 ? 'true' : 'false');
50+
51+
}
52+
}
53+
</script>
54+
<!-- END: weeklist -->

0 commit comments

Comments
 (0)