-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroom.php
130 lines (92 loc) · 3.53 KB
/
room.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
<?php
require_once 'conf/smarty-conf.php';
include 'functions/modules_functions.php';
include 'functions/employees_functions.php';
include 'functions/user_functions.php';
include 'functions/room_type_functions.php';
include 'functions/room_functions.php';
include 'functions/facility_functions.php';
$module_no = 7;
if ($_SESSION ['login'] == 1) {
if (check_access ( $module_no, $_SESSION ['user_id'] ) == 1) {
if ($_REQUEST ['job'] == "rooms_type_form") {
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room.tpl' );
} elseif ($_REQUEST ['job'] == "save") {
if ($_REQUEST ['ok'] == 'Update') {
$id = $_SESSION ['id'];
$info = get_module_info ( $id );
$room_no=$_POST ['room_no'];
$room_cat = $_POST ['room_cat'];
update_rooms ( $id, $room_no,$room_cat );
} else {
$room_no=$_POST ['room_no'];
$room_cat = $_POST ['room_cat'];
$facility= $_POST['facility'];
save_room( $room_no, $room_cat);
$info=get_room_info_by_room_no($room_no);
$nfacility = count($facility);
foreach ($facility AS $value){
$facility_info=get_facility_info($value);
$room_id=$info['id'];
$facility_id=$value;
$facility=$facility_info[facility];
add_facility($room_id, $room_no, $facility_id, $facility);
}
$smarty->assign ( 'room_types', list_room_type() );
}
$smarty->assign ( 'room_types', list_room_type() );
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room.tpl' );
} elseif ($_REQUEST ['job'] == "edit") {
$_SESSION ['id'] = $id = $_REQUEST ['id'];
$info = get_room_info($id);
$smarty->assign ( 'room_no', $info ['room_no'] );
$smarty->assign ( 'room_type', $info ['room_type'] );
$smarty->assign ( 'edit', 'on' );
$smarty->assign ( 'room_types', list_room_type() );
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room.tpl' );
} elseif ($_REQUEST ['job'] == "delete") {
delete_room ( $_REQUEST ['id'] );
$smarty->assign ( 'room_types', list_room_type() );
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room.tpl' );
}
elseif ($_REQUEST ['job'] == "view_room_info") {
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room_detail.tpl' );
}
elseif ($_REQUEST ['job'] == "room_grid_view") {
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room_grid_view.tpl' );
}
elseif ($_REQUEST ['job'] == "room_view_by_status") {
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room_view_by_status.tpl' );
}
elseif ($_REQUEST ['job'] == "room_view_by_status_back") {
$_SESSION['from_date']= $_POST['from_date'];
$_SESSION['to_date']= $_POST['to_date'];
$smarty->assign ( 'from_date', $_SESSION['from_date'] );
$smarty->assign ( 'to_date', $_SESSION['to_date'] );
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room_view_by_status.tpl' );
}
else {
$smarty->assign ( 'room_types', list_room_type() );
$smarty->assign ( 'page', "Rooms" );
$smarty->display ( 'room/room.tpl' );
}
}
else{
$smarty->assign ( 'error_report', "on" );
$smarty->assign ( 'error_message', "Dear $_SESSION[user_name], you don't have permission to Rooms Type Management." );
$smarty->assign ( 'page', "Access Error" );
$smarty->display ( 'user_home/access_error.tpl' );
}
}
else {
$smarty->assign ( 'error', "Incorrect Login Details!" );
$smarty->display('login.tpl');
}