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
7c9408b0
authored
May 31, 2018
by
Zen-PC\Zen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'integration' into kraikrit
parents
aed586b3
5d33e689
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
97 deletions
+140
-97
www/src/Controller/AppController.php
+1
-0
www/src/Controller/UsersController.php
+44
-15
www/src/Template/Element/card_from/from_0.ctp
+76
-0
www/src/Template/UserCards/view_card.ctp
+19
-82
No files found.
www/src/Controller/AppController.php
View file @
7c9408b0
...
@@ -45,6 +45,7 @@ class AppController extends Controller {
...
@@ -45,6 +45,7 @@ class AppController extends Controller {
public
function
initialize
()
{
public
function
initialize
()
{
parent
::
initialize
();
parent
::
initialize
();
//$this->viewBuilder()->theme('Porto');
//$this->viewBuilder()->theme('Porto');
I18n
::
setLocale
(
'th_TH'
);
$this
->
loadComponent
(
'RequestHandler'
);
$this
->
loadComponent
(
'RequestHandler'
);
$this
->
loadComponent
(
'Flash'
);
$this
->
loadComponent
(
'Flash'
);
...
...
www/src/Controller/UsersController.php
View file @
7c9408b0
...
@@ -108,6 +108,33 @@ class UsersController extends AppController {
...
@@ -108,6 +108,33 @@ class UsersController extends AppController {
}
}
}
}
/**
*
* Function mobile re-authorized use automatically by mobile application
* @author sarawutt.b
* @return void
*/
public
function
reautorize
()
{
$this
->
viewBuilder
()
->
layout
(
false
);
$reauthorizeAPI
=
Configure
::
read
(
'Config.apiCore.reauthorize'
);
$http
=
new
Client
();
$data
[
'data'
][
'username'
]
=
'pakgon.demo'
;
$data
[
'data'
][
'password'
]
=
'deio$5679@qETY'
;
$data
[
'data'
][
'ip'
]
=
$this
->
request
->
clientIp
();
$response
=
$http
->
post
(
$reauthorizeAPI
,
$data
[
'data'
],
[
'headers'
=>
[
'Authorization'
=>
$this
->
request
->
getHeaderLine
(
'Authorization'
),
'Accept-Language'
=>
$this
->
request
->
getHeaderLine
(
'Accept-Language'
)
]])
->
body
();
$response
=
json_decode
(
$response
,
true
);
if
(
!
empty
(
$response
[
'result'
][
'user'
]))
{
$response
[
'result'
][
'user'
][
'id'
]
=
$response
[
'result'
][
'user'
][
'user_id'
];
$this
->
Auth
->
setUser
(
$response
[
'result'
][
'user'
]);
return
$this
->
redirect
(
Configure
::
read
(
'RedirectApplicationURL'
));
}
else
{
return
$this
->
redirect
([
'controller'
=>
'Users'
,
'action'
=>
'signin'
]);
}
}
public
function
signup
()
{
public
function
signup
()
{
$this
->
loadModel
(
'MasterCountries'
);
$this
->
loadModel
(
'MasterCountries'
);
$this
->
loadModel
(
'MasterProvinces'
);
$this
->
loadModel
(
'MasterProvinces'
);
...
@@ -492,21 +519,6 @@ class UsersController extends AppController {
...
@@ -492,21 +519,6 @@ class UsersController extends AppController {
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
/**
*
* Function user logout / signout
* @author sarawutt.b
* @since 2018/05/22 16:44:20
* @license PAKGON
* @return void
*/
public
function
signout
()
{
$http
=
new
Client
();
$result
=
$http
->
delete
(
Configure
::
read
(
'OAUTH2_PROVIDER.TOKEN_DETETE'
)
.
'/'
.
$this
->
Auth
->
user
(
'id'
))
->
body
();
$this
->
Flash
->
success
(
__
(
'You are now logged out.'
));
return
$this
->
redirect
(
$this
->
Auth
->
logout
());
}
public
function
forgotsendpin
(
$token
=
null
)
{
public
function
forgotsendpin
(
$token
=
null
)
{
$this
->
loadModel
(
'UserPersonals'
);
$this
->
loadModel
(
'UserPersonals'
);
...
@@ -568,4 +580,21 @@ class UsersController extends AppController {
...
@@ -568,4 +580,21 @@ class UsersController extends AppController {
return
$this
->
redirect
([
'action'
=>
'pin_code/'
.
$token
]);
return
$this
->
redirect
([
'action'
=>
'pin_code/'
.
$token
]);
}
}
/**
*
* Function user logout / signout
* @author sarawutt.b
* @since 2018/05/22 16:44:20
* @license PAKGON
* @return void
*/
public
function
signout
()
{
$http
=
new
Client
();
$result
=
$http
->
delete
(
Configure
::
read
(
'OAUTH2_PROVIDER.TOKEN_DETETE'
)
.
'/'
.
$this
->
Auth
->
user
(
'id'
))
->
body
();
$this
->
Flash
->
success
(
__
(
'You are now logged out.'
));
return
$this
->
redirect
(
$this
->
Auth
->
logout
());
}
}
}
www/src/Template/Element/card_from/from_0.ctp
0 → 100644
View file @
7c9408b0
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal fade" id="defaultModal_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel"
aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="row date-name">
<div class="col-xs-8 ">
<br>
<div>
<label>id</label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<labe>ชื่อ</label>
<?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row date-position">
<div class="col-xs-12">
<label>ตำแหน่ง</label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center date-time">
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-6">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
<div class="row text-center date-label">
<div class="col-xs-6">
<label>วันออกบัตร</label>
</div>
<div class="col-xs-6">
<label>วันหมดออายุ</label>
</div>
</div>
</div>
<!--/ .font-card-->
<div>
<?php echo $this->Html->image('/img/core/img/card-bg-back@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '3position: absolute;')); ?>
</div>
<!--/ .back-card-->
</div>
<!--/.owl-carousel-->
</div>
</div>
<!--/.container -->
</div>
<!--/.box-ads -->
</div>
<!--/.defaultModal -->
</div>
</div>
www/src/Template/UserCards/view_card.ctp
View file @
7c9408b0
...
@@ -13,7 +13,7 @@ use Cake\I18n\Time;
...
@@ -13,7 +13,7 @@ use Cake\I18n\Time;
</div>
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<div class="col-xs-10 col-sm-10 col-md-10">
<div class="box-card">
<div class="box-card">
<div data-toggle="modal" data-target="#
defaultModal
_<?php echo $i;?>" style="cursor: pointer; padding-right: 10px; padding-left: 10px;">
<div data-toggle="modal" data-target="#
card
_<?php echo $i;?>" style="cursor: pointer; padding-right: 10px; padding-left: 10px;">
<div class="row">
<div class="row">
<div class="col-xs-8">
<div class="col-xs-8">
<div style="font-size: 17px">
<div style="font-size: 17px">
...
@@ -128,9 +128,10 @@ use Cake\I18n\Time;
...
@@ -128,9 +128,10 @@ use Cake\I18n\Time;
</div>
</div>
</div>
</div>
<!--/.col-xs-12 -->
<!--/.col-xs-12 -->
</div>
</div>
<!--/.row -->
<!--/.row -->
<?php
<?php
$i++;
$i++;
}
}
...
@@ -148,11 +149,11 @@ use Cake\I18n\Time;
...
@@ -148,11 +149,11 @@ use Cake\I18n\Time;
<div class="row">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserCards', [
<?php echo $this->Form->create('UserCards', [
'id' => 'frmSignIn',
'id' => 'frmSignIn',
'type' => 'file',
'type' => 'file',
'onsubmit' => 'return check();',
'onsubmit' => 'return check();',
'url' => ['controller' => 'user-cards', 'action' => 'view-card']
'url' => ['controller' => 'user-cards', 'action' => 'view-card']
]); ?>
]); ?>
<div class="form-group has-feedback">
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Flash->render(); ?>
<?php echo $this->Flash->render(); ?>
...
@@ -190,82 +191,17 @@ use Cake\I18n\Time;
...
@@ -190,82 +191,17 @@ use Cake\I18n\Time;
<!--/.row -->
<!--/.row -->
</div>
</div>
<!--/.owl-carousel -->
<!--/.owl-carousel -->
<div class="row">
<?php
<div class="col-xs-12 col-sm-12 col-md-12">
$i=0;
<div class="modal fade" id="defaultModal_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
foreach ($UserCards as $value) {
<div class="modal-dialog box-ads">
echo $this->element('card_from/from_0',array('value' => $value,'i'=> $i));
<a class="close-modal" data-dismiss="modal">X </a>
$i++;
<div class="container login-container">
}
<div class="">
?>
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="row date-name">
<div class="col-xs-8 ">
<br>
<div>
<label>id</label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<labe>ชื่อ</label>
<?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row date-position">
<div class="col-xs-12">
<label>ตำแหน่ง</label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center date-time">
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-6">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
<div class="row text-center date-label">
<div class="col-xs-6">
<label>วันออกบัตร</label>
</div>
<div class="col-xs-6">
<label>วันหมดออายุ</label>
</div>
</div>
</div>
<!--/ .font-card-->
<div>
<?php echo $this->Html->image('/img/core/img/card-bg-back@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '3position: absolute;')); ?>
</div>
<!--/ .back-card-->
</div>
<!--/.owl-carousel-->
</div>
</div>
<!--/.container -->
</div>
<!--/.box-ads -->
</div>
<!--/.defaultModal -->
</div>
</div>
</div>
</div>
<style>
<style>
#alertBox {
#alertBox {
position: relative;
position: relative;
...
@@ -661,3 +597,4 @@ use Cake\I18n\Time;
...
@@ -661,3 +597,4 @@ use Cake\I18n\Time;
</script>
</script>
<?php $this->end();?>
<?php $this->end();?>
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