Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Bojan Borovcanin
/
WBT1920_team30
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
31662389
authored
May 11, 2020
by
Bojan Borovcanin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
A lot of changes
parent
3dbf2dca
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
200 additions
and
68 deletions
test/controllers/Activity.php
test/controllers/Pages.php
test/controllers/User.php
test/controllers/Worker.php
test/hooks/acl.php
test/views/pages/activities.php
test/views/pages/home.php
test/views/pages/login.php
test/views/pages/moreAboutActivity.php
test/views/pages/moreAboutApartment.php
test/views/pages/myProfile.php
test/views/pages/workerLogin.php
test/views/pages/workerProfile.php
test/views/templates/header.php
test/controllers/Activity.php
View file @
31662389
...
...
@@ -24,27 +24,29 @@ class Activity extends CI_Controller{
}
public
function
deleteActivity
()
{
{
if
(
isset
(
$_POST
[
'btnDeleteActivity'
]))
{
$this
->
Activity_model
->
deleteActivity
(
$this
->
input
->
post
(
'id'
));
$array
[
'activities'
]
=
$this
->
Activity_model
->
getAllActivities
();
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/activities'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
public
function
moreAboutActivity
()
{
if
(
isset
(
$_POST
[
'more_about_activity'
]))
{
$array
[
'activity'
]
=
$this
->
Activity_model
->
getActivity
(
$this
->
input
->
post
(
'id'
));
$array
[
'activity'
]
=
$this
->
Activity_model
->
getActivity
(
$this
->
input
->
get
(
'id'
));
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/moreAboutActivity'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
...
...
@@ -52,9 +54,7 @@ class Activity extends CI_Controller{
public
function
addNewActivity
()
{
if
(
isset
(
$_POST
[
'addNewActivity'
])
||
isset
(
$_POST
[
'add_new_activity'
]))
{
$this
->
form_validation
->
set_rules
(
'title'
,
'Title'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'description'
,
'Description'
,
'required|max_length[300]'
);
$this
->
form_validation
->
set_rules
(
'datetime'
,
'DateTime'
,
'required'
);
...
...
@@ -102,7 +102,7 @@ class Activity extends CI_Controller{
$this
->
load
->
view
(
'pages/activities'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
}
}
...
...
test/controllers/Pages.php
View file @
31662389
...
...
@@ -35,23 +35,21 @@ public function __construct()
public
function
moreAboutApartment
()
{
if
(
isset
(
$_POST
[
'more_about_apartment'
]))
{
$array
[
'apartment'
]
=
$this
->
Apartment_model
->
getApartment
(
$this
->
input
->
post
(
'id'
));
$array
[
'apartment'
]
=
$this
->
Apartment_model
->
getApartment
(
$this
->
input
->
get
(
'id'
));
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/moreAboutApartment'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
public
function
deleteApartment
()
{
if
(
isset
(
$_POST
[
'delete_apartment'
]))
{
if
(
isset
(
$_POST
[
'btnDeleteApartment'
]))
{
$this
->
Apartment_model
->
deleteApartment
(
$this
->
input
->
post
(
'id'
));
$array
[
'apartments'
]
=
$this
->
Apartment_model
->
getAllApartments
();
...
...
@@ -59,15 +57,13 @@ public function __construct()
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/home'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
}
public
function
addNewApartment
()
{
if
(
isset
(
$_POST
[
'addNewApartment'
])
||
isset
(
$_POST
[
'add_new_apartment'
]))
{
$this
->
form_validation
->
set_rules
(
'title'
,
'Title'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'description'
,
'Description'
,
'required|max_length[200]'
);
$this
->
form_validation
->
set_rules
(
'number_of_beds'
,
'Number of beds'
,
'required'
);
...
...
@@ -118,7 +114,7 @@ public function __construct()
$this
->
load
->
view
(
'templates/footer'
);
}
}
}
...
...
test/controllers/User.php
View file @
31662389
...
...
@@ -18,16 +18,7 @@ class User extends CI_Controller{
public
function
loginButton
()
{
if
(
!
$this
->
session
->
userdata
(
'username'
)){
if
(
!
$this
->
input
->
post
())
{
$this
->
load
->
helper
(
array
(
'form'
));
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/login'
);
$this
->
load
->
view
(
'templates/footer'
);
return
;
}
}
$this
->
form_validation
->
set_rules
(
'username'
,
'Username'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'passwordLogin'
,
'Password'
,
'required|callback_password_check_login'
);
...
...
@@ -40,11 +31,13 @@ class User extends CI_Controller{
$array
[
'profileInfo'
]
=
$this
->
User_model
->
getProfileInfo
(
$_SESSION
[
'logged_in'
][
'username'
]);
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/myProfile'
,
$array
);
$this
->
load
->
view
(
'templates/footer'
);
}
}
public
function
logout
(){
...
...
@@ -142,8 +135,8 @@ class User extends CI_Controller{
if
(
preg_match
(
'#[0-9]#'
,
$str
)
&&
preg_match
(
'#[a-zA-Z]#'
,
$str
))
{
return
TRUE
;
}
$this
->
form_validation
->
set_message
(
'
password_check'
,
$this
->
form_validation
->
set_message
(
'
password_check'
,
'Password have to be a combination of letters and numbers'
);
return
FALSE
;
}
...
...
test/controllers/Worker.php
View file @
31662389
...
...
@@ -32,6 +32,8 @@
$this
->
load
->
view
(
'templates/footer'
);
}
else
{
$array
[
'apartments'
]
=
$this
->
Apartment_model
->
getAllApartments
();
$this
->
load
->
view
(
'templates/header'
);
$this
->
load
->
view
(
'pages/home'
,
$array
);
...
...
test/hooks/acl.php
View file @
31662389
...
...
@@ -12,7 +12,6 @@ $allowAll['Pages']['unauthorized'] = True;
$allowAll
[
'activity'
][
'showActivities'
]
=
True
;
//accesses of individual users user or worker
$allowOnly
[
2
][
'user'
][
'loginButton'
]
=
False
;
$allowOnly
[
2
][
'user'
][
'signUp'
]
=
False
;
$allowOnly
[
2
][
'worker'
][
'workerLogin'
]
=
False
;
$allowOnly
[
2
][
'user'
][
'logout'
]
=
True
;
...
...
@@ -20,6 +19,7 @@ $allowOnly[2]['profile']['myProfile'] =True;
$allowOnly
[
2
][
'pages'
][
'moreAboutApartment'
]
=
True
;
$allowOnly
[
2
][
'activity'
][
'moreAboutActivity'
]
=
True
;
//worker
$allowOnly
[
1
][
'user'
][
'logout'
]
=
true
;
$allowOnly
[
1
][
'user'
][
'signUp'
]
=
False
;
$allowOnly
[
1
][
'profile'
][
'workerProfile'
]
=
true
;
...
...
test/views/pages/activities.php
View file @
31662389
...
...
@@ -140,7 +140,7 @@
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
2
)
{
?>
<form
action=
"
<?php
echo
base_url
();
?>
activity/moreAboutActivity?>"
method=
"
pos
t"
>
<form
action=
"
<?php
echo
base_url
();
?>
activity/moreAboutActivity?>"
method=
"
ge
t"
>
<?php
foreach
(
$activities
as
$activity
)
{
...
...
@@ -157,7 +157,7 @@
<input type='datetime' disabled name='datetime' value='"
.
$activity
[
'datetime'
]
.
"' >
</div>
"
;
echo
"<input type='submit'
id='register_for_activity' name='more_about_activity'
value='More'></br>"
;
echo
"<input type='submit' value='More'></br>"
;
echo
"</div>"
;
}
?>
...
...
@@ -175,7 +175,7 @@
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
1
)
{
?>
<form
action=
"
<?php
echo
base_url
();
?>
activity/deleteActivity?> "
method=
"post
"
>
<form
method=
"post"
action=
"
<?php
echo
base_url
();
?>
activity/deleteActivity
"
>
<div>
<?php
foreach
(
$activities
as
$activity
)
{
echo
"<div>Title:"
.
$activity
[
'title'
]
.
" </div><br>"
;
...
...
@@ -190,7 +190,7 @@
<input type='datetime' disabled name='datetime' value='"
.
$activity
[
'datetime'
]
.
"' >
</div>
"
;
echo
"<input type='submit'
id='delete_activity' name='remove_activity'
value='Delete'></br>"
;
echo
"<input type='submit'
name='btnDeleteActivity'
value='Delete'></br>"
;
}
?>
...
...
test/views/pages/home.php
View file @
31662389
...
...
@@ -185,7 +185,7 @@
<div
class=
"row text-center"
>
<div
class=
"col-sm-4"
>
<div
class=
"thumbnail"
>
<form
action=
"
<?php
echo
base_url
();
?>
pages/deleteApartment
?>
"
method=
"post"
>
<form
action=
"
<?php
echo
base_url
();
?>
pages/deleteApartment"
method=
"post"
>
<?php
foreach
(
$apartments
as
$apartment
)
{
?>
...
...
@@ -193,18 +193,25 @@
echo
"<p><strong> "
.
$apartment
[
'title'
]
.
" </strong></p>"
;
echo
"<p>"
.
$apartment
[
'description'
]
.
" <br> for "
.
$apartment
[
'number_of_beds'
]
.
" persons </p>"
;
echo
"<input type='hidden' name='id' value="
.
$apartment
[
'id_apatment'
]
.
">"
;
echo
"<input type='submit' name='delete_apartment'
value='Delete'></br>"
;
echo
"<input type='submit' name='btnDeleteApartment'
value='Delete'></br>"
;
?>
<?php
}
?>
</form>
<form
method=
"post"
action=
"
<?php
echo
base_url
();
?>
pages/addNewApartment"
>
<input
type=
"submit"
value=
"add new apartment"
>
</form>
<?php
}
?>
<?php
}
?>
</div>
</div>
</div>
</div>
...
...
@@ -220,7 +227,7 @@
<div
class=
"row text-center"
>
<div
class=
"col-sm-4"
>
<div
class=
"thumbnail"
>
<form
action=
"
<?php
echo
base_url
();
?>
/pages/moreAboutApartment"
method=
"pos
t"
>
<form
action=
"
<?php
echo
base_url
();
?>
pages/moreAboutApartment"
method=
"ge
t"
>
<?php
foreach
(
$apartments
as
$apartment
)
{
?>
...
...
@@ -228,12 +235,13 @@
echo
"<p><strong> "
.
$apartment
[
'title'
]
.
" </strong></p>"
;
echo
"<p>"
.
$apartment
[
'description'
]
.
" <br> for "
.
$apartment
[
'number_of_beds'
]
.
" persons </p>"
;
echo
"<input type='hidden' name='id' value="
.
$apartment
[
'id_apatment'
]
.
">"
;
echo
"<input type='submit'
name='more_about_apartment'
value='More'></br>"
;
echo
"<input type='submit' value='More'></br>"
;
?>
<?php
}
?>
</form>
<?php
}
?>
...
...
test/views/pages/login.php
View file @
31662389
...
...
@@ -98,7 +98,10 @@
</nav>
<br>
<h3><center
id=
"wlc_header"
>
Welcome to trump Hotel Login
</center></h3>
<h3><center
id=
"wlc_header"
>
Welcome to trump Hotel Login
</center></h3>
<center>
<h5>
Login as user
</h5>
<form
class=
"form-horizontal"
action=
"
<?php
echo
base_url
();
?>
user/loginButton"
method=
"post"
>
...
...
@@ -120,6 +123,6 @@
<form
method=
"post"
action=
"
<?php
echo
base_url
();
?>
user/signUp"
>
<input
type=
"submit"
id=
"btn_register"
value=
"Register"
/>
</form>
</center>
</body>
</html>
\ No newline at end of file
test/views/pages/moreAboutActivity.php
View file @
31662389
...
...
@@ -15,6 +15,11 @@
</head>
<body>
<br>
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$activity
[
'image'
])
.
'" width = "100px" alt = "image"> '
;
?>
<br>
<label>
Title of the activity:
</label>
<input
type=
"text"
name=
"title"
disabled=
"true"
value=
"
<?php
echo
$activity
[
'title'
];
...
...
@@ -26,6 +31,8 @@
<?php
echo
$activity
[
'description'
];
?>
</textarea>
<br>
<label>
Date and time:
</label>
<input
type=
"datetime"
disabled=
"true"
name=
"datetime"
value=
"
<?php
...
...
test/views/pages/moreAboutApartment.php
View file @
31662389
...
...
@@ -15,7 +15,14 @@
</head>
<body>
<br>
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$apartment
[
'image'
])
.
'" width = "100px" alt = "image"> '
;
?>
<br>
<label>
Title of the apartment:
</label>
<br>
<input
type=
"text"
name=
"title"
disabled=
"true"
value=
"
<?php
echo
$apartment
[
'title'
];
?>
"
>
...
...
test/views/pages/myProfile.php
View file @
31662389
...
...
@@ -17,11 +17,18 @@
</head>
<body>
<h1>
My profile
</h1>
<nav>
<a
class=
"navbar-brand"
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/ikonica.svg"
width=
"50px"
>
</a>
</nav>
<br>
<br>
<br>
<h1>
My profile
</h1>
<label>
First name:
</label>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'FIRSTNAME'
];
...
...
test/views/pages/workerLogin.php
View file @
31662389
...
...
@@ -2,21 +2,107 @@
<html>
<head>
<title></title>
<link
rel=
"stylesheet"
href=
"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity=
"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin=
"anonymous"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"
></script>
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
></script>
<link
href=
"https://fonts.googleapis.com/css?family=Montserrat"
rel=
"stylesheet"
type=
"text/css"
>
<link
href=
"https://fonts.googleapis.com/css?family=Lato"
rel=
"stylesheet"
type=
"text/css"
>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
();
?>
assets/css/home1.css"
>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
();
?>
assets/css/bootstrap.min.css"
>
</head>
<body>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"
></script>
<nav
id =
"navbar"
class=
"navbar navbar-default"
>
<div
id=
"navbarDiv"
class=
"container-fluid"
>
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle"
data-toggle=
"collapse"
data-target=
"#myNavbar"
>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand"
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/ikonica.svg"
width=
"50px"
>
</a>
</div>
<div
class=
"collapse navbar-collapse"
id=
"myNavbar"
>
<ul
class=
"nav navbar-nav navbar-right"
>
<li>
<a
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
Home
</a>
</li>
<li>
<a
href=
"
<?php
echo
base_url
();
?>
activity/showActivities"
>
Activities
</a>
</li>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity=
"sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin=
"anonymous"
></script>
<?php
if
(
isset
(
$_SESSION
[
'logged_in'
]))
{
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
2
)
{
?>
<li>
<a
href=
"
<?php
echo
base_url
();
?>
profile/myProfile"
>
Profile
</a>
</li>
<?php
}
}
?>
<script
src=
"https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity=
"sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin=
"anonymous"
></script>
<script
src=
"https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity=
"sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin=
"anonymous"
></script>
<?php
if
(
isset
(
$_SESSION
[
'logged_in'
]))
{
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
1
)
{
?>
<li>
<a
href=
"
<?php
echo
base_url
();
?>
profile/workerProfile"
>
Profile
</a>
</li>
<?php
}
}
?>
</head>
<body>
<li>
<a
href=
"
<?php
if
(
!
$this
->
session
->
userdata
(
'logged_in'
))
{
echo
base_url
()
.
"user/loginButton"
;
}
else
{
echo
base_url
()
.
"user/logout"
;
}
?>
"
>
<span
class=
"glyphicon glyphicon-log-in"
></span>
<?php
if
(
!
$this
->
session
->
userdata
(
'logged_in'
)){
echo
"Login"
;
}
else
{
echo
"Logout"
;
}
?>
</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<center>
<h3>
Welcome to trump Hotel Login
</h3>
<h5>
Login as worker
</h5>
<form
action=
"
<?php
echo
base_url
();
?>
worker/workerLogin"
method=
"post"
>
<input
type=
"text"
id=
"username"
name=
'usernameWorker'
placeholder=
"username"
maxlength=
"128"
/>
<br>
...
...
@@ -25,7 +111,7 @@
<input
type=
"submit"
name=
"buttonWorkerLogin"
value=
"Login"
>
</form>
</center>
</body>
...
...
test/views/pages/workerProfile.php
View file @
31662389
...
...
@@ -14,8 +14,21 @@
<script
src=
"https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity=
"sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin=
"anonymous"
></script>
</head>
<body>
<nav>
<a
class=
"navbar-brand"
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/ikonica.svg"
width=
"50px"
>
</a>
</nav>
<br>
<center>
<br>
<br>
<h1>
Worker profile
</h1>
<br>
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$profileInfo
[
'image'
])
.
'" width = "100px" alt = "image"> '
;
?>
<br>
<label>
First name:
</label>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'firstname'
];
...
...
@@ -57,6 +70,6 @@
echo
$profileInfo
[
'phone_number'
];
?>
"
>
<br>
</center>
</body>
</html>
\ No newline at end of file
test/views/templates/header.php
View file @
31662389
<!DOCTYPE html>
<html>
<head>
<title>
Trump
Hotel
</title>
<title>
Trump
resort
</title>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
>
...
...
@@ -11,6 +11,7 @@
</head>
<body>
<header>
<div
id=
"myCarousel"
class=
"carousel slide"
data-ride=
"carousel"
>
<!-- Indicators -->
<ol
class=
"carousel-indicators"
>
...
...
@@ -24,24 +25,31 @@
<div
class=
"item active"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/pool.jpg"
alt=
"New York"
>
<div
class=
"carousel-caption"
>
<h1>
Trump resorts
</h1>
<h3>
The nature in Trump resorts is wonderful.
</h3>
<h1>
<a
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
Trump resort
<br>
<h3>
The nature in Trump resorts is wonderful.
</h3></a>
</h1>
</div>
</div>
<div
class=
"item"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/nekihotel.jpg"
alt=
"Chicago"
>
<div
class=
"carousel-caption"
>
<h1>
Trump resorts
</h1>
<h3>
We have the best pool parties.
</h3>
<h1>
<a
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
Trump resort
<br>
<h3>
We have the best pool parties.
</h3>
</a>
</div>
</div>
<div
class=
"item"
>
<img
src=
"
<?php
echo
base_url
();
?>
assets/images/hotel3.jpg"
alt=
"Los Angeles"
>
<div
class=
"carousel-caption"
>
<h1>
Trump resorts
</h1>
<h1>
<a
href=
"
<?php
echo
base_url
();
?>
Pages/view"
>
Trump resort
<br>
<h3>
Time is free. You can't own it, but you can use it.
</h3>
</a>
</div>
</div>
</div>
...
...
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