Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
useranalytics
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
reynaldi adriantama
useranalytics
Commits
8d1be082
Commit
8d1be082
authored
Oct 01, 2020
by
reynaldi adriantama
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile picture
parent
f8a16683
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
137 additions
and
14 deletions
+137
-14
module/Application/config/module.config.php
module/Application/config/module.config.php
+11
-1
module/Application/src/Controller/ApiController.php
module/Application/src/Controller/ApiController.php
+53
-0
module/Application/src/Controller/UserController.php
module/Application/src/Controller/UserController.php
+5
-1
module/Application/src/Controller/UseranalyticsController.php
...le/Application/src/Controller/UseranalyticsController.php
+14
-2
module/Application/view/application/user/profile.phtml
module/Application/view/application/user/profile.phtml
+33
-3
module/Application/view/application/useranalytics/menu.phtml
module/Application/view/application/useranalytics/menu.phtml
+1
-1
module/Application/view/layout/menu.phtml
module/Application/view/layout/menu.phtml
+1
-1
public/action-js/index-js/generate-website-token.js
public/action-js/index-js/generate-website-token.js
+6
-3
public/action-js/index-js/user-profile-action.js
public/action-js/index-js/user-profile-action.js
+12
-2
vendor/Khansia/Access/User.php
vendor/Khansia/Access/User.php
+1
-0
No files found.
module/Application/config/module.config.php
View file @
8d1be082
...
...
@@ -35,6 +35,16 @@ return [
],
],
],
'profile'
=>
[
'type'
=>
Literal
::
class
,
'options'
=>
[
'route'
=>
'/user/profile'
,
'defaults'
=>
[
'controller'
=>
Controller\UserController
::
class
,
'action'
=>
'profile'
,
],
],
],
'application'
=>
[
'type'
=>
Segment
::
class
,
'options'
=>
[
...
...
@@ -160,7 +170,7 @@ return [
'not_found_template'
=>
'error/404'
,
'exception_template'
=>
'error/index'
,
'template_map'
=>
[
'layout/layout'
=>
__DIR__
.
'/../view/layout/l
ogin
.phtml'
,
'layout/layout'
=>
__DIR__
.
'/../view/layout/l
ayout
.phtml'
,
'application/index/index'
=>
__DIR__
.
'/../view/application/index/index.phtml'
,
'error/404'
=>
__DIR__
.
'/../view/error/404.phtml'
,
'error/index'
=>
__DIR__
.
'/../view/error/index.phtml'
,
...
...
module/Application/src/Controller/ApiController.php
View file @
8d1be082
...
...
@@ -1688,6 +1688,59 @@ class ApiController extends \Application\Master\GlobalActionController {
return
$this
->
getOutput
(
$result
->
toJson
());
}
public
function
editpictureAction
(){
$result
=
new
Result
();
$request
=
$this
->
getRequest
();
$post
=
$request
->
getPost
();
$uri
=
$this
->
getRequest
()
->
getUri
();
$baseurl
=
sprintf
(
'//%s'
,
$uri
->
getHost
());
$storage
=
\Application\Model\Param\Storage
::
factory
(
$this
->
getDb
(),
$this
->
getConfig
());
$param
=
new
\Application\Model\Param
(
$storage
);
$session_data
=
$this
->
getSession
();
// echo "halo braiiiiiiiiiiiiiiiiiiii";
if
(
$request
->
isPost
()){
$datafile
=
$request
->
getFiles
()
->
toArray
();
$datapost
=
$request
->
getPost
()
->
toArray
();
}
$array_merge
=
array_merge
(
$datafile
,
$datapost
);
// $this->redirect()->toRoute('home');
// print_r($array_merge['myfile2']['name']);die;
// return new ViewModel();
$namafile
=
$array_merge
[
'myfile2'
][
'name'
];
$namasementara
=
$array_merge
[
'myfile2'
][
'tmp_name'
];
$dirUpload
=
"public/img/profilepic"
;
$upload
=
move_uploaded_file
(
$namasementara
,
$dirUpload
.
"/"
.
$namafile
);
if
(
$upload
){
$tabel
=
'user_data_header'
;
$dataArray
=
array
(
'profilepicture'
=>
$namafile
,
);
$where
=
array
(
'iduser'
=>
$array_merge
[
'id'
],
);
$load
=
$param
->
updateGlobal
(
$tabel
,
$dataArray
,
$where
);
// echo "sucess";
if
(
$load
){
$result
->
code
=
$result
::
CODE_SUCCESS
;
$result
->
info
=
$result
::
INFO_SUCCESS
;
// $result->data = $load->data;
$session_data
->
put
(
null
,
array
(
'profilepicture'
=>
$namafile
));
$this
->
redirect
()
->
toRoute
(
'profile'
);
}
else
{
$result
->
code
=
1
;
$result
->
info
=
'Not Found'
;
}
}
}
}
...
...
module/Application/src/Controller/UserController.php
View file @
8d1be082
...
...
@@ -115,7 +115,7 @@ class UserController extends \Application\Master\GlobalActionController
'create_dtm'
=>
$user
->
create_dtm
,
'access'
=>
$accessArray
,
'role_code'
=>
$access
->
data
[
0
][
'role_code'
],
'profilepicture'
=>
$user
->
profilepicture
,
));
$session
->
flush
();
...
...
@@ -206,6 +206,7 @@ class UserController extends \Application\Master\GlobalActionController
'name'
=>
$session_data
->
get
(
'name'
),
'email'
=>
$session_data
->
get
(
'email'
),
'username'
=>
$session_data
->
get
(
'usernamed'
),
'pp'
=>
$session_data
->
get
(
'profilepicture'
),
));
...
...
@@ -213,6 +214,7 @@ class UserController extends \Application\Master\GlobalActionController
$this
->
headScript
->
appendScript
(
' var idUserProfile = "'
.
$session_data
->
get
(
'user_id'
)
.
'"'
);
$this
->
headScript
->
appendFile
(
'/action-js/index-js/user-profile-action.js'
);
$this
->
layout
()
->
myParameter
=
$session_data
->
get
(
'usernamed'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
"layout/menu"
);
return
$view
;
}
...
...
@@ -242,4 +244,6 @@ class UserController extends \Application\Master\GlobalActionController
return
$view
;
}
}
module/Application/src/Controller/UseranalyticsController.php
View file @
8d1be082
...
...
@@ -99,6 +99,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this
->
layout
()
->
myParameter
=
$session_data
->
get
(
'usernamed'
);
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
"layout/menu"
);
return
$view
;
}
...
...
@@ -135,11 +136,13 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
'username'
=>
$session_data
->
get
(
'usernamed'
),
'email'
=>
$session_data
->
get
(
'email'
),
'token'
=>
$session_data
->
get
(
'token'
),
'pp'
=>
$session_data
->
get
(
'profilepicture'
),
));
//print_r($session_data->get('token'));die;
$this
->
layout
()
->
myParameter
=
$session_data
->
get
(
'usernamed'
);
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
"layout/menu"
);
return
$view
;
}
...
...
@@ -167,6 +170,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this
->
layout
()
->
myParameter
=
$session_data
->
get
(
'usernamed'
);
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
"layout/menu"
);
return
$view
;
}
...
...
@@ -207,6 +211,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -237,6 +242,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -272,6 +278,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -303,6 +310,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -334,6 +342,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -365,6 +374,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -396,6 +406,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
@@ -429,6 +440,7 @@ class UseranalyticsController extends \Application\Master\GlobalActionController
//print_r($baseurl);die;
$this
->
layout
()
->
token
=
$session_data
->
get
(
'token'
);
$this
->
layout
()
->
webname
=
$session_data
->
get
(
'websitename'
);
$this
->
layout
()
->
pp
=
$session_data
->
get
(
'profilepicture'
);
$this
->
layout
(
'layout/menu'
);
return
$view
;
}
...
...
module/Application/view/application/user/profile.phtml
View file @
8d1be082
<div
class=
"container-fluid"
>
<div
class=
"row justify-content-center"
id=
"hui"
>
<div
class=
"col-xl-
5 col-lg-12
col-md-9"
>
<div
class=
"col-xl-
6 col-lg-6
col-md-9"
>
<div
class=
"card o-hidden border-0 shadow-lg my-5"
>
<div
class=
"card-body p-0 border-left-primary"
>
<!-- Nested Row within Card Body -->
...
...
@@ -13,8 +13,7 @@
<hr>
<form
class=
"user"
>
<div
class=
"row justify-content-center mb-2"
>
<img
id=
"image"
src=
"http://via.placeholder.com/150x150"
style=
"width:100px; height:100px;border-radius:50%"
/>
<input
type=
"file"
onchange=
"readURL(this)"
id=
"myfile"
style=
"display:none"
/>
<img
id=
"image"
src=
"
<?php
$img
=
$this
->
pp
;
if
(
isset
(
$this
->
pp
)){
echo
$this
->
basePath
(
'/img/profilepic/'
)
.
$img
;}
else
{
echo
"http://via.placeholder.com/150x150"
;}
?>
"
style=
"width:100px; height:100px;border-radius:50%"
/>
</div>
<div
class=
"row "
>
<div
class=
"col-xl-4 col-md-4 col-lg-3 "
><b>
Username
</b>
</div>
...
...
@@ -122,3 +121,34 @@
</
div
>
</
div
>
</
div
>
<!--
profile
modal
-->
<
div
class
=
"modal fade"
id
=
"picturemodal"
tabindex
=
"-1"
role
=
"dialog"
aria
-
labelledby
=
"exampleModalLabel"
aria
-
hidden
=
"true"
>
<
div
class
=
"modal-dialog"
role
=
"document"
>
<
div
class
=
"modal-content"
>
<
div
class
=
"modal-header"
>
<
h5
class
=
"modal-title"
id
=
"exampleModalLabel"
>
Change
Profile
picture
</
h5
>
<
button
class
=
"close"
type
=
"button"
data
-
dismiss
=
"modal"
aria
-
label
=
"Close"
>
<
span
aria
-
hidden
=
"true"
>
×
</
span
>
</
button
>
</
div
>
<
div
class
=
"modal-body"
>
<
form
class
=
"user"
method
=
"post"
action
=
"<?php
$this->basePath
(); ?>/api/editpicture"
enctype
=
"multipart/form-data"
>
<
input
type
=
"hidden"
name
=
"id"
value
=
"<?php echo
$this->id_user
; ?>"
>
<
div
class
=
"row justify-content-center"
>
<
img
id
=
"image2"
src
=
"<?php
$img
=
$this->pp
; if(isset(
$this->pp
)){echo
$this->basePath
('/img/profilepic/').
$img
;}else { echo "
http
://
via
.
placeholder
.
com
/
150
x150
";} ?>"
style
=
"width:100px; height:100px;border-radius:50%"
/>
</
div
>
<
div
class
=
"row justify-content-center mt-4"
>
<
br
><
input
type
=
"file"
onchange
=
"readURL(this)"
id
=
"myfile2"
name
=
"myfile2"
/>
</
div
>
<!--
<
button
value
=
"upload"
type
=
"submit"
class
=
"btn btn-primary"
id
=
"btnEditpp"
href
=
"<?php //echo
$this->basePath
('user/logout'); ?>"
>
Change
</
button
>
-->
<!--
</
form
>
-->
</
div
>
<
div
class
=
"modal-footer"
>
<
button
class
=
"btn btn-secondary"
type
=
"button"
data
-
dismiss
=
"modal"
>
Cancel
</
button
>
<
button
value
=
"upload"
type
=
"submit"
class
=
"btn btn-primary"
id
=
"btnEditpp"
href
=
"<?php //echo
$this->basePath
('user/logout'); ?>"
>
Change
</
button
>
</
form
>
</
div
>
</
div
>
</
div
>
</
div
>
\ No newline at end of file
module/Application/view/application/useranalytics/menu.phtml
View file @
8d1be082
...
...
@@ -16,7 +16,7 @@
<div
class=
"col-lg-12"
>
<div
class=
"p-5"
>
<div
class=
"text-center"
>
<h1
class=
"h4 text-gray-900 mb-4"
>
Pilih website
</h1>
<h1
class=
"h4 text-gray-900 mb-4"
>
Pilih website
<?php
//echo $this->pp;?>
</h1>
</
div
>
<
hr
>
<
form
class
=
"user"
>
...
...
module/Application/view/layout/menu.phtml
View file @
8d1be082
...
...
@@ -186,7 +186,7 @@
<
li
class
=
"nav-item dropdown no-arrow"
>
<
a
class
=
"nav-link dropdown-toggle"
href
=
"#"
id
=
"userDropdown"
role
=
"button"
data
-
toggle
=
"dropdown"
aria
-
haspopup
=
"true"
aria
-
expanded
=
"false"
>
<
span
id
=
"usernameDisplay"
class
=
"mr-2 d-none d-lg-inline text-gray-600 small"
><?
php
echo
$this
->
myParameter
;
?>
</span>
<img
class=
"img-profile rounded-circle"
src=
"
https://www.dovercourt.org/wp-content/uploads/2019/11/610-6104451_image-placeholder-png-user-profile-placeholder-image-png.jpg
"
>
<img
class=
"img-profile rounded-circle"
src=
"
<?php
$img
=
$this
->
pp
;
if
(
isset
(
$this
->
pp
)){
echo
$this
->
basePath
(
'/img/profilepic/'
)
.
$img
;}
else
{
echo
"http://via.placeholder.com/150x150"
;}
?>
"
>
</a>
<!-- Dropdown - User Information -->
<div
class=
"dropdown-menu dropdown-menu-right shadow animated--grow-in"
aria-labelledby=
"userDropdown"
>
...
...
public/action-js/index-js/generate-website-token.js
View file @
8d1be082
...
...
@@ -138,14 +138,17 @@ $(document).ready(function(){
let
$post
=
false
;
if
(
$websiteName
==
null
||
$websiteName
==
""
){
alert
(
"
nama website kosong
"
);
//
alert("nama website kosong");
//$post = false;
$
(
"
#alertweb
"
).
html
(
"
nama website tidak boleh kosong
"
);
return
false
}
else
if
(
$websiteDomain
==
null
||
$websiteDomain
==
""
){
alert
(
"
domain kosong
"
);
// alert("domain kosong");
$
(
"
#alertweb
"
).
html
(
"
domain tidak boleh kosong
"
);
return
false
}
else
if
(
$averageAge
==
null
||
$averageAge
==
""
){
alert
(
"
age kosong
"
);
// alert("age kosong");
$
(
"
#alertweb
"
).
html
(
"
age tidak boleh kosong
"
);
return
false
}
...
...
public/action-js/index-js/user-profile-action.js
View file @
8d1be082
...
...
@@ -27,7 +27,17 @@ $("#btnPas").on("click", function(e){
$
(
document
).
ready
(
function
(){
$
(
'
#image
'
).
click
(
function
(){
$
(
'
#myfile
'
).
click
()
// $('#myfile').click()
// document.getElementById("picturemodal").showModal();
$
(
"
#picturemodal
"
).
modal
();
})
})
$
(
document
).
ready
(
function
(){
$
(
'
#image2
'
).
click
(
function
(){
$
(
'
#myfile2
'
).
click
()
// document.getElementById("picturemodal").showModal();
// $("#picturemodal").modal();
})
})
...
...
@@ -36,7 +46,7 @@ function readURL(input){
var
reader
=
new
FileReader
();
reader
.
onload
=
function
(
e
){
$
(
"
#image
"
).
attr
(
"
src
"
,
e
.
target
.
result
);
$
(
"
#image
2
"
).
attr
(
"
src
"
,
e
.
target
.
result
);
};
reader
.
readAsDataURL
(
input
.
files
[
0
]);
...
...
vendor/Khansia/Access/User.php
View file @
8d1be082
...
...
@@ -49,6 +49,7 @@ class User extends \Khansia\Generic\Objects\Mapper {
new
Map
(
'create_dtm'
),
new
Map
(
'retries'
),
new
Map
(
'email'
),
new
Map
(
'profilepicture'
),
),
parent
::
CASE_INSENSITIVE
);
...
...
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