Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
smart_core_connect
/
core-connect
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f51bf3de
authored
May 16, 2018
by
Zen-PC\Zen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zen : update email
parent
d68b3251
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
5 deletions
+37
-5
www/src/Controller/ProfilesController.php
+30
-4
www/src/Template/Profiles/index.ctp
+7
-1
No files found.
www/src/Controller/ProfilesController.php
View file @
f51bf3de
...
...
@@ -51,6 +51,7 @@ class ProfilesController extends AppController
if
(
$this
->
request
->
is
([
'patch'
,
'post'
,
'put'
]))
{
$data
=
$this
->
request
->
data
;
// pr($this->request->data);die;
$this
->
loadModel
(
'UserPersonals'
);
$userPersonals
=
$this
->
UserPersonals
->
find
(
'all'
,
...
...
@@ -60,13 +61,35 @@ class ProfilesController extends AppController
'user_id'
=>
$data
[
'Users'
][
'user_id'
]
]
]
)
->
toArray
();
)
->
first
();
// pr($userPersonals);die;
if
(
$userPersonals
[
'email'
]
==
$this
->
request
->
data
[
'UserPersonals'
][
'email'
]){
$chkemail
=
true
;
}
else
{
$userPersonals
=
$this
->
UserPersonals
->
find
(
'all'
,
[
'limit'
=>
1
,
'conditions'
=>
[
'email'
=>
$data
[
'UserPersonals'
][
'email'
]
]
]
)
->
toArray
();
if
(
empty
(
$userPersonals
)){
$chkemail
=
true
;
}
else
{
$chkemail
=
false
;
}
}
if
(
$chkemail
==
true
){
$birthdate
=
explode
(
"/"
,
$this
->
request
->
data
[
'UserPersonals'
][
'birthdate'
]);
$birthdate
=
$birthdate
[
2
]
.
'-'
.
$birthdate
[
1
]
.
'-'
.
$birthdate
[
0
];
$userPersonals
=
$this
->
UserPersonals
->
patchEntity
(
$userPersonals
[
0
]
,
$data
[
'UserPersonals'
]);
$userPersonals
=
$this
->
UserPersonals
->
patchEntity
(
$userPersonals
,
$data
[
'UserPersonals'
]);
$userPersonals
[
'firstname_th'
]
=
$this
->
request
->
data
[
'UserPersonals'
][
'firstname_th'
];
$userPersonals
[
'lastname_th'
]
=
$this
->
request
->
data
[
'UserPersonals'
][
'lastname_th'
];
$userPersonals
[
'email'
]
=
$this
->
request
->
data
[
'UserPersonals'
][
'email'
];
$userPersonals
[
'birthdate'
]
=
$birthdate
;
$userPersonals
[
'user_id'
]
=
$data
[
'Users'
][
'user_id'
];
$userPersonals
[
'master_country_id'
]
=
$this
->
request
->
data
[
'master_country_id'
];
...
...
@@ -74,10 +97,13 @@ class ProfilesController extends AppController
$userPersonals
[
'modified_by'
]
=
''
;
if
(
$this
->
UserPersonals
->
save
(
$userPersonals
))
{
$this
->
Flash
->
success
(
__
(
'
The article has been saved
.'
));
$this
->
Flash
->
success
(
__
(
'
Update Complete
.'
));
return
$this
->
redirect
([
'action'
=>
'index'
]);
}
$this
->
Flash
->
error
(
__
(
'The article could not be saved. Please, try again.'
));
}
else
{
$this
->
Flash
->
error
(
__
(
'Email Address already used by others.'
));
}
$this
->
Flash
->
error
(
__
(
'Not update. Please, try again.'
));
}
$this
->
set
(
compact
(
'userPersonals'
,
'responseUserProfile'
,
'dateNow'
,
'username'
,
'Country'
,
'Province'
));
$this
->
set
(
'_serialize'
,
[
'userPersonals'
,
'responseUserProfile'
,
'dateNow'
,
'username'
,
'Country'
,
'Province'
]);
...
...
www/src/Template/Profiles/index.ctp
View file @
f51bf3de
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file']); ?>
<div style="position: absolute;z-index: 2;">
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a>
</div>
...
...
@@ -17,6 +17,12 @@
</div>
<div class="bg-profile"></div>
<!--<div class="col-xs-12 col-sm-12 col-md-12" style="padding-top: 20px;">-->
</div><!--/col-xs-12-->
</div><!--/row-->
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file']); ?>
<?php echo $this->Flash->render() ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
...
...
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