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
715251a9
authored
May 12, 2020
by
Bojan Borovcanin
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Almost there
parent
ade2c6bf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
89 additions
and
89 deletions
assets/css/workerRegistration.css
test/controllers/Worker.php
test/models/Worker_model.php
test/views/pages/activities.php
test/views/pages/addNewActivity.php
test/views/pages/addNewApartment.php
test/views/pages/home.php
test/views/pages/moreAboutActivity.php
test/views/pages/workerProfile.php
test/views/pages/workerRegistration.php
assets/css/workerRegistration.css
View file @
715251a9
.imagePreview
{
width
:
350px
;
height
:
200px
;
...
...
test/controllers/Worker.php
View file @
715251a9
...
...
@@ -61,7 +61,7 @@
public
function
workerSignup
()
{
$this
->
form_validation
->
set_rules
(
'firstname'
,
'Firstname'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'lastname'
,
'Last
t
name'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'lastname'
,
'Lastname'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'dateofbirth'
,
'Date of birth'
,
'required'
);
$this
->
form_validation
->
set_rules
(
'gender'
,
'Gender'
,
'required'
);
$this
->
form_validation
->
set_rules
(
'worker_name'
,
'Worker name'
,
'required|max_length[30]|callback_worker_name_is_unique'
);
...
...
@@ -72,7 +72,6 @@
$this
->
form_validation
->
set_rules
(
'city'
,
'City'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'profession'
,
'Profession'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'phone_number'
,
'Phone number'
,
'required|max_length[30]'
);
$this
->
form_validation
->
set_rules
(
'inpImage'
,
'Image '
,
'required'
);
if
(
$this
->
form_validation
->
run
()
==
FALSE
){
$data
[
'countries'
]
=
$this
->
User_model
->
getAllCountries
();
...
...
@@ -82,8 +81,6 @@
}
else
{
$verification_key
=
md5
(
rand
());
$data
[
'firstname'
]
=
$this
->
input
->
post
(
'firstname'
);
$data
[
'lastname'
]
=
$this
->
input
->
post
(
'lastname'
);
$data
[
'worker_name'
]
=
$this
->
input
->
post
(
'worker_name'
);
...
...
@@ -96,9 +93,7 @@
$data
[
'proffesion'
]
=
$this
->
input
->
post
(
'profession'
);
$data
[
'phone_number'
]
=
$this
->
input
->
post
(
'phone_number'
);
$data
[
'image'
]
=
$this
->
input
->
post
(
'inpImage'
);
$id
=
$this
->
Worker_model
->
insertWorker
(
$data
);
$this
->
Worker_model
->
insertWorker
(
$data
);
$array
[
'apartments'
]
=
$this
->
Apartment_model
->
getAllApartments
();
...
...
test/models/Worker_model.php
View file @
715251a9
...
...
@@ -34,7 +34,6 @@ class Worker_model extends CI_Model{
public
function
insertWorker
(
$data
)
{
$this
->
db
->
insert
(
'worker'
,
$data
);
return
$this
->
db
->
insert_id
();
}
public
function
authenticatePassword
(
$username
,
$passwordLogin
)
...
...
test/views/pages/activities.php
View file @
715251a9
...
...
@@ -56,6 +56,20 @@
}
}
?>
<?php
if
(
isset
(
$_SESSION
[
'logged_in'
]))
{
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
1
)
{
?>
<li>
<a
href=
"
<?php
echo
base_url
();
?>
worker/workerSignup"
>
Add New Worker
</a>
</li>
<?php
}
}
?>
<?php
if
(
isset
(
$_SESSION
[
'logged_in'
]))
...
...
@@ -178,6 +192,7 @@
?>
<form
method=
"post"
action=
"
<?php
echo
base_url
();
?>
activity/deleteActivity"
>
<div
class=
"container-fluid bg-grey"
>
<h6>
<?php
foreach
(
$activities
as
$activity
)
{
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$activity
[
'image'
])
.
'" width = "100px" alt = "image"> '
;
...
...
@@ -197,7 +212,7 @@
</div>
</form>
</form>
<h6><form
action=
"
<?php
echo
base_url
();
?>
activity/addNewActivity?>"
method=
"post"
>
<input
type=
"submit"
name=
"addNewActivity"
value=
"Add new activity"
>
...
...
@@ -206,6 +221,6 @@
}
}
?>
</body>
</html>
\ No newline at end of file
test/views/pages/addNewActivity.php
View file @
715251a9
...
...
@@ -115,7 +115,7 @@
<input
class=
"form-control"
id=
"datetime"
type=
"datetime-local"
min=
"
<?php
echo
date
(
'Y-m-d'
);
?>
T00:00"
name=
"datetime"
>
<div
class=
"errors"
>
<?php
echo
form_error
(
'datetime'
);
?>
</div>
<br>
<center>
<div
>
<?php
echo
form_error
(
'inpImage'
);
?>
</div>
<div
>
...
...
@@ -128,6 +128,7 @@
<input
class=
"chooseFile"
type=
"file"
name=
"inpImage"
id=
"inpImage"
>
</div>
</center>
<script>
const
inpImage
=
document
.
getElementById
(
"inpImage"
);
...
...
test/views/pages/addNewApartment.php
View file @
715251a9
...
...
@@ -141,6 +141,7 @@
<div
class=
"errors"
>
<?php
echo
form_error
(
'email'
);
?>
</div>
<br>
<center>
<div
>
<?php
echo
form_error
(
'inpImage'
);
?>
</div>
<div
>
...
...
@@ -152,7 +153,7 @@
<input
type=
"file"
name=
"inpImage"
id=
"inpImage"
>
</div>
</center>
<script>
const
inpImage
=
document
.
getElementById
(
"inpImage"
);
const
previewContainer
=
document
.
getElementById
(
"imagePreview"
);
...
...
test/views/pages/home.php
View file @
715251a9
...
...
@@ -182,11 +182,12 @@
if
(
$_SESSION
[
'logged_in'
][
'acl'
]
==
1
)
{
?>
<div
class=
"row text-center"
>
<div
class=
"col-sm-4"
>
<div
class=
"row text-center"
style=
"margin-left: 25%"
>
<div
class=
"col-sm-8"
>
<div
class=
"thumbnail"
>
<form
action=
"
<?php
echo
base_url
();
?>
pages/deleteApartment"
method=
"post"
>
<center>
<?php
foreach
(
$apartments
as
$apartment
)
{
?>
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$apartment
[
'image'
])
.
'" alt = "image"> '
;
...
...
@@ -197,6 +198,7 @@
?>
<?php
}
?>
</center>
</form>
...
...
@@ -216,6 +218,7 @@
</div>
</div>
<!-- Rooms: user logged in -->
<?php
...
...
test/views/pages/moreAboutActivity.php
View file @
715251a9
...
...
@@ -16,7 +16,7 @@
<body>
<br>
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$activity
[
'image'
])
.
'" width = "
1
00px" alt = "image"> '
;
<?php
echo
'<img src="data:image/jpeg;base64,'
.
base64_encode
(
$activity
[
'image'
])
.
'" width = "
3
00px" alt = "image"> '
;
?>
<br>
...
...
test/views/pages/workerProfile.php
View file @
715251a9
...
...
@@ -2,16 +2,22 @@
<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"
>
<style>
.fakeimg
{
height
:
200px
;
background
:
#aaa
;
}
</style>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity=
"sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin=
"anonymous"
></script>
<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>
</head>
<body>
<nav>
...
...
@@ -20,56 +26,72 @@
</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"> '
;
?>
<div
class=
"container"
style=
"margin-top:30px ; color: #21d5ed"
>
<h3>
Worker profile
</h3>
</div>
<div
class=
"container"
style=
"margin-top:30px"
>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
<h5>
Profile photo:
</h5>
<div
class=
"fakeimg"
>
Fake Image
</div>
</div>
<div
class=
"col-sm-8"
>
<br>
<label>
First name:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'firstname'
];
?>
"
>
<br>
<label>
Last name:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'lastname'
];
?>
"
>
<br>
<label>
Worker name:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'worker_name'
];
?>
"
>
<br>
<label>
Email:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'email'
];
?>
"
>
<br>
<label>
Date of birth:
</label>
<br>
<input
type=
"date"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'date_of_birth'
];
?>
"
>
<br>
<label>
Proffesion:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'proffesion'
];
?>
"
>
<br>
<label>
Phone number:
</label>
<br>
<input
type=
"text"
name=
"firstname"
disabled=
"true"
value=
"
<?php
echo
$profileInfo
[
'phone_number'
];
?>
"
>
<br>
</center
>
</div
>
</body>
</html>
\ No newline at end of file
test/views/pages/workerRegistration.php
View file @
715251a9
...
...
@@ -2,38 +2,39 @@
<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"
>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
();
?>
assets/css/bootstrap.min.css"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"
></script>
<script
src=
"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity=
"sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin=
"anonymous"
></script>
<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>
<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/workerRegistration.css"
>
<link
rel=
"stylesheet"
href=
"
<?php
echo
base_url
();
?>
assets/css/home1.css"
>
</head>
<body>
Complete the registration to register as a worker and wait for confirmation
<center>
<h5>
Complete the registration to register a new worker
</h5>
<br>
<div>
<form
method=
"post"
action=
"
<?php
echo
base_url
();
?>
worker/workerSignup"
>
<br>
<label>
First name:
</label>
<label
class=
"workerRegistration"
>
First name:
</label>
<br>
<input
type=
"text"
name=
"firstname"
placeholder=
"Firstname"
>
<div
class=
"errors"
>
<?php
echo
form_error
(
'firstname'
);
?>
</div>
<br>
<label>
Last name:
</label>
<br>
<input
type=
"text"
name=
"lastname"
placeholder=
"Lastname"
>
<div
class=
"errors"
>
<?php
echo
form_error
(
'lastname'
);
?>
</div>
<br>
<label>
BIRTH DATE:
</label>
<br>
<input
type=
"Date"
id=
"datefield"
min=
"1899-01-01"
max=
"
<?php
echo
date
(
'Y-m-d'
);
?>
"
name=
"dateofbirth"
placeholder=
"Birth date"
>
...
...
@@ -74,7 +75,7 @@
<div
class=
"errors"
>
<?php
echo
form_error
(
'email'
);
?>
</div>
<br>
<label>
Select your country
</label
>
<label>
Select your country
</label><br
>
<select
name=
"selectCountry"
>
<option
selected=
""
>
Country
</option>
<?php
...
...
@@ -106,53 +107,12 @@
<div
class=
"errors"
>
<?php
echo
form_error
(
'phone_number'
);
?>
</div>
<br>
<label>
Choose your profile image
</label>
<br>
<div
class=
"errors"
>
<?php
echo
form_error
(
'inpImage'
);
?>
</div>
<div
class=
"box2"
>
<div
class=
"imagePreview"
id=
"imagePreview"
>
<img
src=
""
alt=
"Image preview"
class=
"image-preview__image"
>
<span
class=
"image-preview__default-text"
>
Image preview
</span>
</div>
<br>
<input
class=
"chooseFile"
type=
"File"
name=
"inpImage"
id=
"inpImage"
accept=
"image/*"
>
</div>
<script>
const
inpImage
=
document
.
getElementById
(
"inpImage"
);
const
previewContainer
=
document
.
getElementById
(
"imagePreview"
);
const
previewImage
=
previewContainer
.
querySelector
(
".image-preview__image"
);
const
previewDefaultText
=
previewContainer
.
querySelector
(
".image-preview__default-text"
);
inpImage
.
addEventListener
(
"change"
,
function
(){
const
file
=
this
.
files
[
0
];
if
(
file
)
{
const
reader
=
new
FileReader
();
previewDefaultText
.
style
.
display
=
"none"
;
previewImage
.
style
.
display
=
"block"
;
reader
.
addEventListener
(
"load"
,
function
(){
previewImage
.
setAttribute
(
"src"
,
this
.
result
);
});
reader
.
readAsDataURL
(
file
);
}
else
{
previewDefaultText
.
style
.
display
=
null
;
previewImage
.
style
.
display
=
null
;
previewImage
.
setAttribute
(
"src"
,
""
);
}
});
</script>
<br>
<input
id=
"btn_signup_worker"
type=
"submit"
name=
"signup-submit"
>
</form>
</div>
</center>
</body>
</html>
\ No newline at end of file
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