Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-193 User-friendly enhanced machine learning-based railway management system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-193
2021-193 User-friendly enhanced machine learning-based railway management system
Commits
ba159270
Commit
ba159270
authored
Oct 02, 2021
by
Mihiranga G.L.V - IT18500790
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trip plan custermized
parent
2d01e32f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
173 additions
and
27 deletions
+173
-27
sub_arrange_cat.php
sub_arrange_cat.php
+48
-0
sub_arrange_line.php
sub_arrange_line.php
+48
-0
train_planned.php
train_planned.php
+77
-27
No files found.
sub_arrange_cat.php
0 → 100644
View file @
ba159270
<?php
session_start
();
include
"db_connect.php"
;
$logUserid
=
mysqli_real_escape_string
(
$con
,
$_POST
[
'logUserid'
]);
$catDropValue
=
mysqli_real_escape_string
(
$con
,
$_POST
[
'catDropValue'
]);
$sql1
=
"SELECT * FROM catlist WHERE logUserid =
$logUserid
ORDER BY `priority` ASC "
;
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
$cat_list
=
array
();
while
(
$row1
=
mysqli_fetch_array
(
$result1
)){
array_push
(
$cat_list
,
$row1
[
'catNo'
]);
}
function
repositionArrayElement
(
array
&
$array
,
$key
,
int
$order
)
:
void
{
if
((
$a
=
array_search
(
$key
,
array_keys
(
$array
)))
===
false
){
throw
new
\Exception
(
"The
{
$key
}
cannot be found in the given array."
);
}
$p1
=
array_splice
(
$array
,
$a
,
1
);
$p2
=
array_splice
(
$array
,
0
,
$order
);
$array
=
array_merge
(
$p2
,
$p1
,
$array
);
}
$cat_index_in_array
=
array_search
(
$catDropValue
,
$cat_list
);
repositionArrayElement
(
$cat_list
,
$cat_index_in_array
,
0
);
$sql3
=
"SELECT * FROM catlist WHERE logUserid = '
$logUserid
'"
;
$result3
=
mysqli_query
(
$con
,
$sql3
)
or
die
(
mysqli_error
(
$con
));
$rowcount3
=
mysqli_num_rows
(
$result3
);
if
(
$rowcount3
>
0
){
$sql4
=
"DELETE FROM catlist WHERE logUserid='
$logUserid
'"
;
$result4
=
mysqli_query
(
$con
,
$sql4
)
or
die
(
mysqli_error
(
$con
));
}
for
(
$i
=
0
;
$i
<
6
;
$i
++
){
$priority
=
$i
+
1
;
$catNo
=
$cat_list
[
$i
];
$sql1
=
"INSERT INTO `catlist`(`logUserid`, `catNo`, `priority`) VALUES ('
$logUserid
','
$catNo
','
$priority
')"
;
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
}
?>
\ No newline at end of file
sub_arrange_line.php
0 → 100644
View file @
ba159270
<?php
session_start
();
include
"db_connect.php"
;
$logUserid
=
mysqli_real_escape_string
(
$con
,
$_POST
[
'logUserid'
]);
$lineDropValue
=
mysqli_real_escape_string
(
$con
,
$_POST
[
'lineDropValue'
]);
$sql1
=
"SELECT * FROM linelist WHERE logUserid =
$logUserid
ORDER BY `priority` ASC "
;
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
$line_list
=
array
();
while
(
$row1
=
mysqli_fetch_array
(
$result1
)){
array_push
(
$line_list
,
$row1
[
'lineNo'
]);
}
function
repositionArrayElement
(
array
&
$array
,
$key
,
int
$order
)
:
void
{
if
((
$a
=
array_search
(
$key
,
array_keys
(
$array
)))
===
false
){
throw
new
\Exception
(
"The
{
$key
}
cannot be found in the given array."
);
}
$p1
=
array_splice
(
$array
,
$a
,
1
);
$p2
=
array_splice
(
$array
,
0
,
$order
);
$array
=
array_merge
(
$p2
,
$p1
,
$array
);
}
$line_index_in_array
=
array_search
(
$lineDropValue
,
$line_list
);
repositionArrayElement
(
$line_list
,
$line_index_in_array
,
0
);
$sql3
=
"SELECT * FROM linelist WHERE logUserid = '
$logUserid
'"
;
$result3
=
mysqli_query
(
$con
,
$sql3
)
or
die
(
mysqli_error
(
$con
));
$rowcount3
=
mysqli_num_rows
(
$result3
);
if
(
$rowcount3
>
0
){
$sql4
=
"DELETE FROM linelist WHERE logUserid='
$logUserid
'"
;
$result4
=
mysqli_query
(
$con
,
$sql4
)
or
die
(
mysqli_error
(
$con
));
}
for
(
$i
=
0
;
$i
<
6
;
$i
++
){
$priority
=
$i
+
1
;
$lineNo
=
$line_list
[
$i
];
$sql1
=
"INSERT INTO `linelist`(`logUserid`, `lineNo`, `priority`) VALUES ('
$logUserid
','
$lineNo
','
$priority
')"
;
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
}
?>
\ No newline at end of file
train_planned.php
View file @
ba159270
...
@@ -124,7 +124,7 @@
...
@@ -124,7 +124,7 @@
if
(
req
.
readyState
==
4
)
{
if
(
req
.
readyState
==
4
)
{
if
(
req
.
status
==
200
)
{
if
(
req
.
status
==
200
)
{
// alert(req.responseText);
// alert(req.responseText);
console
.
log
(
req
.
responseText
);
//
console.log(req.responseText);
document
.
getElementById
(
`collapseOne`
).
innerHTML
=
req
.
responseText
;
document
.
getElementById
(
`collapseOne`
).
innerHTML
=
req
.
responseText
;
}
}
}
}
...
@@ -226,13 +226,10 @@
...
@@ -226,13 +226,10 @@
<div
class=
"x_slider_form_input_wrapper float_left"
>
<div
class=
"x_slider_form_input_wrapper float_left"
>
<h3>
Railway Line
</h3>
<h3>
Railway Line
</h3>
<div
class=
"x_slider_select"
style=
"width: 100%; margin-top: 0px;"
>
<div
class=
"x_slider_select"
style=
"width: 100%; margin-top: 0px;"
>
<select
class=
"myselect form-control"
>
<select
class=
"myselect form-control"
onchange=
"setToLine(this.value);"
>
<?php
<?php
$sql1
=
"SELECT * FROM linelist WHERE logUserid =
$logUserid
ORDER BY `priority` ASC"
;
$sql1
=
"SELECT * FROM linelist WHERE logUserid =
$logUserid
ORDER BY `priority` ASC"
;
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
$result1
=
mysqli_query
(
$con
,
$sql1
)
or
die
(
mysqli_error
(
$con
));
?>
<option
value=
"select"
>
Select Line
</option>
<?php
while
(
$row1
=
mysqli_fetch_array
(
$result1
)){
while
(
$row1
=
mysqli_fetch_array
(
$result1
)){
$slected_line_no
=
$row1
[
'lineNo'
];
$slected_line_no
=
$row1
[
'lineNo'
];
...
@@ -242,7 +239,7 @@
...
@@ -242,7 +239,7 @@
$row2
=
mysqli_fetch_assoc
(
$result2
)
$row2
=
mysqli_fetch_assoc
(
$result2
)
?>
?>
<option
value=
"
<?php
echo
$
slected_line_no
?>
"
>
<?php
echo
$row2
[
'line'
]
?>
</option>
<option
value=
"
<?php
echo
$
row2
[
'id'
]
?>
"
>
<?php
echo
$row2
[
'line'
]
?>
</option>
<?php
<?php
}
}
?>
?>
...
@@ -252,26 +249,28 @@
...
@@ -252,26 +249,28 @@
</div>
</div>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<div
class=
"x_slider_form_input_wrapper float_left"
>
<div
class=
"x_slider_form_input_wrapper float_left"
>
<h3>
Start Location
</h3>
<h3>
Location Category
</h3>
<div
class=
"x_slider_select"
style=
"width: 100%; margin-top: 0px;"
>
<div
class=
"x_slider_select"
style=
"width: 100%; margin-top: 0px;"
>
<select
class=
"myselect form-control"
>
<select
class=
"myselect form-control"
onchange=
"setToCat(this.value)"
>
<option>
Select Location
</option>
<?php
<option>
Colombo
</option>
$sql3
=
"SELECT * FROM catlist WHERE logUserid =
$logUserid
ORDER BY `priority` ASC"
;
<option>
Maradhana
</option>
$result3
=
mysqli_query
(
$con
,
$sql3
)
or
die
(
mysqli_error
(
$con
));
<option>
Kurunagala
</option>
while
(
$row3
=
mysqli_fetch_array
(
$result3
)){
</select>
</div>
$selected_cat_id
=
$row3
[
'catNo'
];
</div>
</div>
$sql4
=
"SELECT * FROM category WHERE id = '
$selected_cat_id
' "
;
<div
class=
"col-md-12"
>
$result4
=
mysqli_query
(
$con
,
$sql4
)
or
die
(
mysqli_error
(
$con
));
<div
class=
"form-sec-header"
>
$row4
=
mysqli_fetch_assoc
(
$result4
)
<h3>
End Location
</h3>
<div
class=
"x_slider_select"
style=
"width: 100%; margin-top: 0px;"
>
?>
<select
class=
"myselect form-control"
>
<option
value=
"
<?php
echo
$row4
[
'id'
]
?>
"
>
<?php
echo
$row4
[
'name'
]
?>
</option>
<option>
Select Location
</option>
<option>
Pattipola
</option>
<?php
<option>
Ella
</option>
<option>
Badulla
</option>
}
?>
</select>
</select>
</div>
</div>
</div>
</div>
...
@@ -298,6 +297,57 @@
...
@@ -298,6 +297,57 @@
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function
setToCat
(
value
)
{
let
logUserid
=
document
.
getElementById
(
`logUserid`
).
value
;
let
catDropValue
=
value
;
var
formData
=
new
FormData
();
formData
.
append
(
'
logUserid
'
,
logUserid
);
formData
.
append
(
'
catDropValue
'
,
catDropValue
);
var
req
=
getXmlHttpRequestObject
();
if
(
req
)
{
req
.
onreadystatechange
=
function
()
{
if
(
req
.
readyState
==
4
)
{
if
(
req
.
status
==
200
)
{
// alert(req.responseText);
// console.log(req.responseText);
createTripPlan
();
}
}
}
req
.
open
(
"
POST
"
,
'
sub_arrange_cat.php
'
,
true
);
req
.
send
(
formData
);
}
}
function
setToLine
(
value
){
let
logUserid
=
document
.
getElementById
(
`logUserid`
).
value
;
let
lineDropValue
=
value
;
var
formData
=
new
FormData
();
formData
.
append
(
'
logUserid
'
,
logUserid
);
formData
.
append
(
'
lineDropValue
'
,
lineDropValue
);
var
req
=
getXmlHttpRequestObject
();
if
(
req
)
{
req
.
onreadystatechange
=
function
()
{
if
(
req
.
readyState
==
4
)
{
if
(
req
.
status
==
200
)
{
createTripPlan
();
}
}
}
req
.
open
(
"
POST
"
,
'
sub_arrange_line.php
'
,
true
);
req
.
send
(
formData
);
}
}
</script>
<div
class=
"col-xl-9 col-lg-8 col-md-12 col-sm-12 col-12"
>
<div
class=
"col-xl-9 col-lg-8 col-md-12 col-sm-12 col-12"
>
<div
class=
"x_carbooking_right_section_wrapper float_left"
>
<div
class=
"x_carbooking_right_section_wrapper float_left"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment