Commit 48ca970a by opal007

Merge branch 'integration' into opal007

parents 56347e4f daa6d701
......@@ -362,6 +362,25 @@ return [
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
'db_temp' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Postgres',
'persistent' => false,
'host' => '122.155.223.38',
'port' => '5432',
//'port' => 'non_standard_port_number',
'username' => 'connect06',
'password' => 'c0nn@6',
'database' => 'connect06',
'encoding' => 'utf8',
'schema' => 'temp',
'timezone' => 'UTC',
'cacheMetadata' => true,
'quoteIdentifiers' => false,
'log' => false,
//'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
'url' => env('DATABASE_TEST_URL', null),
],
],
/**
......
<?php
namespace App\Controller;
use App\Controller\AppController;
use Cake\Core\Configure;
use Cake\Http\Client;
class ProfilesController extends AppController
{
public function index()
{
$this->viewBuilder()->layout('blank');
/*******************************/
/*******************************/
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
#'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
#'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
]
];
$api_core_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_core_profile,$data,$options)->body();
$response = json_decode($response,'_full');#prr($response);
$Profiles = $response['result']['Data'];
$Profiles['UserProfiles']['organize_id'] = 10;
$Profiles['UserProfiles']['dept_id'] = 10;
#debug($Profiles);
$this->set(compact('Profiles'));
#$this->set('_serialize', ['Profiles']);
#---------------------------------------------------------------------------------------------------------------
$this->loadModel('MasterOrganizations');
@$MasterDepartmentEducations = $this->MasterOrganizations->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['organize_id']],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterDepartmentEducations)) $MasterDepartmentEducations = $MasterDepartmentEducations->toArray();
$this->set(compact('MasterDepartmentEducations'));
//debug($MasterDepartmentEducations[0]['org_name_th']);
$this->loadModel('MasterDepartments');
@$MasterDepartments_v = $this->MasterDepartments->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['dept_id']],
'keyField' => 'id',
'valueField' => 'dept_name_th',
'order' => 'dept_name_th asc'
]
);
if(!empty($MasterDepartments_v)) $MasterDepartments_v = $MasterDepartments_v->toArray();
$this->set(compact('MasterDepartments_v'));
//debug($MasterDepartments_v);
$this->loadModel('MasterSections');
@$MasterSections_v = $this->MasterSections->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['section_id']],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
]
);
if(!empty($MasterSections_v)) $MasterSections_v = $MasterSections_v->toArray();
$this->set(compact('MasterSections_v'));
//debug($MasterSections_v);
}
/*****************************************************************************/
/*****************************************************************************/
public function settingProfile()
{
//prr($this->request->getHeaderLine('Accept-Language'));
$this->viewBuilder()->layout('blank');
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI5NCwidXNlcm5hbWUiOiJOYW5hOCIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYThhMzQzYmRiNjNiNzYxZWFjMTFmYzBlOGU2ZDQ2NjE5YyJ9.B2vi2ftThzO8bfv7xDx3lgpo_3-us-S10OzBpFmRn2Q'
]
];
//debug($options);
$api_core_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_core_profile,$data,$options)->body();
$response = json_decode($response,'_full');#prr($response);
$Profiles = $response['result']['Data'];
$this->set(compact('Profiles'));
#$Profiles['UserProfiles'][0]['organize_id'] = 10;
#$Profiles['UserProfiles'][0]['dept_id'] = 10;
#debug($Profiles);
$count_user_profile = count($Profiles['UserProfiles']);
//$Profiles['UserProfiles'] = $Profiles['UserProfiles'][0];
$Profiles['UserProfiles']['education'] = @$Profiles['UserProfiles'][0];
unset($Profiles['UserProfiles'][0]);
if(count($Profiles['UserProfiles']) > 1){ $Profiles['UserProfiles']['work'] = $Profiles['UserProfiles'][1];unset($Profiles['UserProfiles'][1]);}
//$master_language_id = $Profiles['UserDefaultLanguages']['master_language_id'];
$master_language_id = $this->request->getHeaderLine('Accept-Language');
$this->loadModel('MasterLanguages');
$MasterLanguages = $this->MasterLanguages->find('list',
[
'conditions' => ['id' => $master_language_id],
'keyField' => 'id',
'valueField' => 'language_abbr'
]
);
if(!empty($MasterLanguages)) $MasterLanguages = $MasterLanguages->toArray();
#prd($MasterLanguages);
//$language = strtolower($MasterLanguages[$master_language_id]);
#Education
#---------------------------------------------------------------------------------------------------------------
$this->loadModel('MasterOrganizations');
$MasterOrganizationEducations = $this->MasterOrganizations->find('list',
[
'conditions' => ['master_organization_type_id' => 1],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterOrganizationEducations)) $MasterOrganizationEducations = $MasterOrganizationEducations->toArray();
$this->set(compact('MasterOrganizations'));
//debug($MasterOrganizationEducations);
$this->loadModel('MasterDepartments');
$MasterDepartments = $this->MasterDepartments->find('list',
[
//'conditions' => ['master_organization_id' => $Profiles['UserProfiles']['education']['organize_id']],
//'conditions' => ['master_organization_id' => $Profiles['UserProfiles'][0]['organize_id']],
'conditions' => ['master_organization_id' => 7],
'keyField' => 'id',
'valueField' => 'dept_name_th',
'order' => 'dept_name_th asc'
]
);
if(!empty($MasterDepartments)) $MasterDepartments = $MasterDepartments->toArray();
$this->set(compact('MasterDepartments'));
//debug($MasterDepartments);
$this->loadModel('MasterSections');
$MasterSections = $this->MasterSections->find('list',
[
//'conditions' => ['master_department_id' => $Profiles['UserProfiles']['education']['dept_id']],
//'conditions' => ['master_department_id' => $Profiles['UserProfiles'][0]['dept_id']],
'conditions' => ['master_department_id' => 49],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
]
);
if(!empty($MasterSections)) $MasterSections = $MasterSections->toArray();
$this->set(compact('MasterSections'));
//debug($MasterSections);
#Work
#---------------------------------------------------------------------------------------------------------------
$MasterOrganizationPositions = [];
if(!empty($Profiles['UserProfiles']['work']['organize_id'])){
$this->loadModel('MasterOrganizationPositions');
$MasterOrganizationPositions = $this->MasterOrganizationPositions->find('list',
[
'conditions' => ['master_organization_id' => $Profiles['UserProfiles']['work']['organize_id']],
'keyField' => 'id',
'valueField' => 'organization_position_name',
'order' => 'organization_position_name asc'
]
);
if(!empty($MasterOrganizationPositions)) $MasterOrganizationPositions = $MasterOrganizationPositions->toArray();
#prd($MasterOrganizationPositions);
}
$this->loadModel('MasterBusinessTypes');
$MasterBusinessTypes = $this->MasterBusinessTypes->find('list',
[
'conditions' => ['master_language_id' => $master_language_id],
'keyField' => 'id',
'valueField' => 'business_type_name',
'order' => 'business_type_name asc',
]
);
if(!empty($MasterBusinessTypes)) $MasterBusinessTypes = $MasterBusinessTypes->toArray();
#prd($MasterBusinessTypes);
$this->loadModel('MasterOrganizations');
$MasterOrganizationWorks = $this->MasterOrganizations->find('list',
[
'conditions' => ['master_organization_type_id' => 2],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterOrganizationWorks)) $MasterOrganizationWorks = $MasterOrganizationWorks->toArray();
#prd($MasterOrganizationWorks);
$MasterSectionWorks = [];
if(!empty($Profiles['UserProfiles']['work']['dept_id'])){
$this->loadModel('MasterSections');
$MasterSectionWorks = $this->MasterSections->find('list',
[
'conditions' => ['master_department_id' => $Profiles['UserProfiles']['work']['dept_id']],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
]
);
if(!empty($MasterSectionWorks)) $MasterSectionWorks = $MasterSectionWorks->toArray();
#prd($MasterSectionWorks);
}
#debug($Profiles);
$this->set(compact(
'Profiles',
'MasterOrganizationEducations', 'MasterDepartmentEducations', 'MasterSectionEducations',
'MasterOrganizationPositions', 'MasterBusinessTypes', 'MasterOrganizationWorks', 'MasterSectionWorks'
));
}
public function updateProfile()
{
$this->viewBuilder()->layout('blank');
$data = $this->request->data;#debug($data);
#$api_update_profile = 'http://connect06.pakgon.com/api/Connects/Profile/updateProfile';
#$api_update_profile = Configure::read('Config.apiCore.profile').'/updateProfile';
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI5NCwidXNlcm5hbWUiOiJOYW5hOCIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYThhMzQzYmRiNjNiNzYxZWFjMTFmYzBlOGU2ZDQ2NjE5YyJ9.B2vi2ftThzO8bfv7xDx3lgpo_3-us-S10OzBpFmRn2Q'
]
];
//debug($options);exit();
$api_update_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_update_profile,$data,$options)->body();
//debug($response);
$response = json_decode($response,'_full');#debug($response);
$Profiles = $response['result']['Data'];
$this->set(compact('Profiles'));
$this->loadModel('UserPersonLists');
$this->loadModel('UserProfiles');
$this->loadModel('AppAccess');
$this->loadModel('SubjectEnrolls');
//debug($this->request->data);
if ($this->request->is('post')) {
#59294
//if (!empty($this->request->data)) {
$UserPersonLists_V = $this->UserPersonLists->find('all',
[
#'conditions' => ['is_used' => true,'username' => $data['username']],
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
'fields' => ['id', 'user_id'],
'limit' => 1
]
)->toArray();
//debug($UserPersonLists[0]['id']);exit();
//if (empty($UserPersonLists[0]['id'] == null)) {
if (!empty($UserPersonLists_V)) {
foreach($this->request->data as $UserPersonLists) {
//$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$UserPersonLists['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$UserPersonLists['master_department_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$UserPersonLists['master_section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$UserPersonLists['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$UserPersonLists['first_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['last_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['master_user_type_id'] = '1';
$UserPersonLists['user_id'] = $this->request->data['data']['Users']['id'];
$UserPersonLists['is_used'] = '1';
$UserPersonLists['created'] = date('Y-m-d H:i:s');
$UserPersonLists['create_uid'] = '0';
$UserPersonLists['modified'] = date('Y-m-d H:i:s');
$UserPersonLists['update_uid'] = '0';
$UserPersonLists['master_prefix_id'] = '1';
//debug($UserPersonLists);exit();
if (empty($UserPersonLists['card_code'] == null || $UserPersonLists['master_organization_id'] == null || $UserPersonLists['master_department_id'] == null || $UserPersonLists['master_section_id'] == null)) {
if ($this->UserPersonLists->save($UserPersonLists)) {
}
} else{
$this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}else {
foreach($this->request->data as $UserPersonLists) {
$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
//$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$UserPersonLists['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$UserPersonLists['master_department_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$UserPersonLists['master_section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$UserPersonLists['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$UserPersonLists['first_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['last_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['master_user_type_id'] = '1';
$UserPersonLists['user_id'] = $this->request->data['data']['Users']['id'];
$UserPersonLists['is_used'] = '1';
$UserPersonLists['created'] = date('Y-m-d H:i:s');
$UserPersonLists['create_uid'] = '0';
$UserPersonLists['modified'] = date('Y-m-d H:i:s');
$UserPersonLists['update_uid'] = '0';
$UserPersonLists['master_prefix_id'] = '1';
//debug($UserPersonLists);exit();
if (empty($UserPersonLists['card_code'] == null || $UserPersonLists['master_organization_id'] == null || $UserPersonLists['master_department_id'] == null || $UserPersonLists['master_section_id'] == null)) {
if ($this->UserPersonLists->save($UserPersonLists)) {
}
} else{
$this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}
$UserProfiles = $this->UserProfiles->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//debug($this->request->data['data']['Users']['id']);exit();
if (!empty($this->request->data['data']['Users']['id'])) {
foreach($UserProfiles as $user_profiles) {
$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
//$date = date_create('2000-01-01');
//$user_profiles['id'] = $this->request->data['data']['Users']['id'];
//$user_profiles['user_id'] = $this->request->data['data']['Users']['id'];
$user_profiles['organize_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$user_profiles['dept_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$user_profiles['section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$user_profiles['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$user_profiles['user_type_id'] = '1';
$user_profiles['img_path'] = '';
//$user_profiles['is_used'] = '1';
//$user_profiles['created_by'] = '0';
$user_profiles['created'] = date('Y-m-d H:i:s');
$user_profiles['modified_by'] = '0';
$user_profiles['modified'] = date('Y-m-d H:i:s');
//$user_profiles['position_org'] = '195';
//$user_profiles['position_edu'] = '89';
$user_profiles['enter_date'] = date('Y-m-d');
$user_profiles['address'] = $this->request->data['data']['UserProfiles']['education']['address'];
$user_profiles['master_business_type_id'] = '0';
$user_profiles['phone_no'] = $this->request->data['data']['UserProfiles']['education']['phone_no'];
$user_profiles['master_organization_position_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
//debug($this->request->data)
//debug($this->UserProfiles->save($user_profiles));exit;
//debug($user_profiles);exit();
if($this->UserProfiles->save($user_profiles)){
}
//return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
}else {
foreach($this->request->data as $UserPersonLists) {
$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
//$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$user_profiles['organize_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$user_profiles['dept_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$user_profiles['section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$user_profiles['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$user_profiles['user_type_id'] = '1';
$user_profiles['img_path'] = '';
//$user_profiles['is_used'] = '1';
//$user_profiles['created_by'] = '0';
$user_profiles['created'] = date('Y-m-d H:i:s');
$user_profiles['modified_by'] = '0';
$user_profiles['modified'] = date('Y-m-d H:i:s');
//$user_profiles['position_org'] = '195';
//$user_profiles['position_edu'] = '89';
$user_profiles['enter_date'] = date('Y-m-d');
$user_profiles['address'] = $this->request->data['data']['UserProfiles']['education']['address'];
$user_profiles['master_business_type_id'] = '0';
$user_profiles['phone_no'] = $this->request->data['data']['UserProfiles']['education']['phone_no'];
$user_profiles['master_organization_position_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
//debug($UserPersonLists);exit();
if ($this->UserPersonLists->save($UserPersonLists)) {
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}
$AppAccess = $this->AppAccess->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
//'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//debug($AppAccess);//exit();
//debug($AppAccess);exit();
if (!empty($AppAccess)) {
//debug($AppAccess);exit();
foreach($AppAccess as $app_access) {
//debug($app_access);exit();
//debug($this->request->data['data']['Users']['id']);exit();
$app_access=$this->AppAccess->get($app_access['id']);
//$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
//$app_access=$this->AppAccess->newEntity();
//debug($AppAccess);exit();
$AppAccess['user_id'] = $this->request->data['data']['Users']['id'];
$app_access['master_app_id'] = '3';
$app_access['is_used'] = '1';
$app_access['create_uid'] = '0';
$app_access['created'] = date('Y-m-d H:i:s');
$app_access['update_uid'] = '0';
$app_access['modified'] = date('Y-m-d H:i:s');
//debug($app_access);exit();
if($this->AppAccess->save($app_access)){
}
}
}else{
//debug($this->request->data['data']['Users']['id']);exit();
foreach($this->request->data as $app_access) {
//debug($this->request->data);exit();
//debug($this->request->data['data']['Users']['id']);exit();
//$app_access=$this->AppAccess->get($app_access['id']);
//$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
$app_access=$this->AppAccess->newEntity();
//debug($this->request->data['data']['Users']['id']);exit();
$app_access['user_id'] = $this->request->data['data']['Users']['id'];
$app_access['master_app_id'] = '3';
$app_access['is_used'] = '1';
$app_access['create_uid'] = '0';
$app_access['created'] = date('Y-m-d H:i:s');
$app_access['update_uid'] = '0';
$app_access['modified'] = date('Y-m-d H:i:s');
//debug($app_access);exit();
if($this->AppAccess->save($app_access)){
}
}
}
$SubjectEnrolls = $this->SubjectEnrolls->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
//'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//$SubjectEnrolls = $this->SubjectEnrolls->find('all')->toArray();
//debug($SubjectEnrolls);exit();
if (!empty($SubjectEnrolls)) {
foreach($this->request->data as $subject_enrolls) {
//debug($subject_enrolls);exit();
$subject_enrolls=$this->SubjectEnrolls->get($SubjectEnrolls[0]['id']);
//$subject_enrolls=$this->SubjectEnrolls->newEntity();
$subject_enrolls['subject_id'] = '';
$subject_enrolls['user_id'] = $this->request->data['data']['Users']['id'];
$subject_enrolls['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$subject_enrolls['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$subject_enrolls['is_used'] = '1';
$subject_enrolls['create_uid'] = '0';
$subject_enrolls['created'] = date('Y-m-d H:i:s');
$subject_enrolls['update_uid'] = '0';
$subject_enrolls['modified'] = date('Y-m-d H:i:s');
//debug($subject_enrolls);exit();
if($this->SubjectEnrolls->save($subject_enrolls)){
if (empty($subject_enrolls)) {
$this->Session->setFlash(__("ไม่ถูกต้อง"));
return false;
}
}
}
}else{
foreach($this->request->data as $subject_enrolls) {
//debug($subject_enrolls);exit();
//$subject_enrolls=$this->SubjectEnrolls->get($SubjectEnrolls[0]['id']);
$subject_enrolls=$this->SubjectEnrolls->newEntity();
$subject_enrolls['subject_id'] = '';
$subject_enrolls['user_id'] = $this->request->data['data']['Users']['id'];
$subject_enrolls['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$subject_enrolls['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$subject_enrolls['is_used'] = '1';
$subject_enrolls['create_uid'] = '0';
$subject_enrolls['created'] = date('Y-m-d H:i:s');
$subject_enrolls['update_uid'] = '0';
$subject_enrolls['modified'] = date('Y-m-d H:i:s');
//debug($subject_enrolls);exit();
if($this->SubjectEnrolls->save($subject_enrolls)){
if (empty($subject_enrolls)) {
$this->Session->setFlash(__("ไม่ถูกต้อง"));
return false;
}
}
}
}
//}
// $this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
// return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($UserPersonLists);exit();
$this->Flash->success(__('ปรับปรุงข้อมูลสำเร็จ'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
public function profileCard()
{
$this->viewBuilder()->layout('blank');
}
}
......@@ -8,73 +8,77 @@ use Cake\Http\Client;
class ProfilesController extends AppController
{
public function index()
{
public function index($id = 13112){
$this->viewBuilder()->layout('blank');
/*******************************/
/*******************************/
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
#'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
#'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
]
];
$api_core_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_core_profile,$data,$options)->body();
$response = json_decode($response,'_full');#prr($response);
$Profiles = $response['result']['Data'];
$Profiles['UserProfiles']['organize_id'] = 10;
$Profiles['UserProfiles']['dept_id'] = 10;
#debug($Profiles);
$this->set(compact('Profiles'));
#$this->set('_serialize', ['Profiles']);
#---------------------------------------------------------------------------------------------------------------
$this->loadModel('MasterOrganizations');
@$MasterDepartmentEducations = $this->MasterOrganizations->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['organize_id']],
$this->loadModel('Users');
$responseUserProfile = $this->Users->get($id, [
'contain' => []
]);
$username = $responseUserProfile['username'];
//********DropdownCountry********
$this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [
'conditions' => [
'is_used' => true],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterDepartmentEducations)) $MasterDepartmentEducations = $MasterDepartmentEducations->toArray();
$this->set(compact('MasterDepartmentEducations'));
//debug($MasterDepartmentEducations[0]['org_name_th']);
$this->loadModel('MasterDepartments');
@$MasterDepartments_v = $this->MasterDepartments->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['dept_id']],
'valueField' => 'country_name_th'
]);
if(!empty($Country)) $Country = $Country->toArray();
//********DropdownProvince********
$this->loadModel('MasterProvinces');
$Province = $this->MasterProvinces->find('list', [
'conditions' => [
'is_used' => true],
'keyField' => 'id',
'valueField' => 'dept_name_th',
'order' => 'dept_name_th asc'
]
);
if(!empty($MasterDepartments_v)) $MasterDepartments_v = $MasterDepartments_v->toArray();
$this->set(compact('MasterDepartments_v'));
//debug($MasterDepartments_v);
$this->loadModel('MasterSections');
@$MasterSections_v = $this->MasterSections->find('all',
'valueField' => 'province_name_th'
]);
if(!empty($Province)) $Province = $Province->toArray();
$this->loadModel('UserPersonals');
$responseUserProfile = $this->UserPersonals->get($id, [
'contain' => []
]);
$res = $responseUserProfile['birthdate'];
$dateNow = $res->i18nFormat('dd/MM/yyyy');
if ($this->request->is(['patch', 'post', 'put'])) {
$data = $this->request->data;
// pr($this->request->data);die;
$this->loadModel('UserPersonals');
$userPersonals = $this->UserPersonals->find('all',
[
'conditions' => ['id' => $Profiles['UserProfiles'][0]['section_id']],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
'limit' => 1,
'conditions' => [
'user_id' => $data['Users']['user_id']
]
);
if(!empty($MasterSections_v)) $MasterSections_v = $MasterSections_v->toArray();
$this->set(compact('MasterSections_v'));
//debug($MasterSections_v);
]
)->toArray();
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
$userPersonals = $this->UserPersonals->patchEntity($userPersonals[0], $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th'];
$userPersonals['birthdate'] = $birthdate;
$userPersonals['user_id'] = $data['Users']['user_id'];
$userPersonals['master_country_id'] = $this->request->data['master_country_id'];
$userPersonals['master_province_id'] = $this->request->data['master_province_id'];
$userPersonals['modified_by'] = '';
if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('The article has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The article could not be saved. Please, try again.'));
}
$this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province'));
$this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province']);
}
/*****************************************************************************/
......
<?php
namespace App\Controller;
use App\Controller\AppController;
/**
* UserCards Controller
*
* @property \App\Model\Table\UserCardsTable $UserCards
*
* @method \App\Model\Entity\UserCard[] paginate($object = null, array $settings = [])
*/
class UserCardsController extends AppController
{
/**
* Index method
*
* @return \Cake\Http\Response|void
*/
public function index()
{
$this->paginate = [
'contain' => ['Users', 'Organizes']
];
$userCards = $this->paginate($this->UserCards);
$this->set(compact('userCards'));
$this->set('_serialize', ['userCards']);
}
/**
* View method
*
* @param string|null $id User Card id.
* @return \Cake\Http\Response|void
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$userCard = $this->UserCards->get($id, [
'contain' => ['Users', 'Organizes']
]);
$this->set('userCard', $userCard);
$this->set('_serialize', ['userCard']);
}
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$userCard = $this->UserCards->newEntity();
if ($this->request->is('post')) {
$userCard = $this->UserCards->patchEntity($userCard, $this->request->getData());
if ($this->UserCards->save($userCard)) {
$this->Flash->success(__('The user card has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The user card could not be saved. Please, try again.'));
}
$users = $this->UserCards->Users->find('list', ['limit' => 200]);
$organizes = $this->UserCards->Organizes->find('list', ['limit' => 200]);
$this->set(compact('userCard', 'users', 'organizes'));
$this->set('_serialize', ['userCard']);
}
/**
* Edit method
*
* @param string|null $id User Card id.
* @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$userCard = $this->UserCards->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$userCard = $this->UserCards->patchEntity($userCard, $this->request->getData());
if ($this->UserCards->save($userCard)) {
$this->Flash->success(__('The user card has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The user card could not be saved. Please, try again.'));
}
$users = $this->UserCards->Users->find('list', ['limit' => 200]);
$organizes = $this->UserCards->Organizes->find('list', ['limit' => 200]);
$this->set(compact('userCard', 'users', 'organizes'));
$this->set('_serialize', ['userCard']);
}
/**
* Delete method
*
* @param string|null $id User Card id.
* @return \Cake\Http\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$userCard = $this->UserCards->get($id);
if ($this->UserCards->delete($userCard)) {
$this->Flash->success(__('The user card has been deleted.'));
} else {
$this->Flash->error(__('The user card could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
public function createCards()
{
$this->viewBuilder()->layout('blank');
$this->loadModel('TempUserCards');
$this->loadModel('MasterOrganizations');
if ($this->request->is('post')) {
// pr($this->Auth);die;
// pr($this->request->data());die;
$birthdate = explode("/", $this->request->data['UserCards']['birthdate']);
$birthdate = $birthdate['2'].'-'.$birthdate['1'].'-'.$birthdate['0'];
$TempUserCards = $this->TempUserCards->find('all', [
'conditions' => [
'organize_id' => $this->request->data['UserCards']['organize_id'],
'card_code' => $this->request->data['UserCards']['employee'],
'birthdate' => $birthdate
]
])->toArray();
$TempUserCards = $this->TempUserCards->get($TempUserCards[0]['id']);
// pr($TempUserCards);die;
// pr($this->TempUserCards->get($TempUserCards[0]['id']));die;
$userCard = $this->UserCards->newEntity();
//pr($userCard);die;
// $userCard = $this->UserCards->patchEntity($userCard, $TempUserCards);
$userCard = $TempUserCards;
$userCard['user_id'] = 1;
$userCard['id'] = null;
// pr($userCard->toArray());die;
if ($this->UserCards->save($userCard)) {
$this->Flash->success(__('The user card has been saved.'));
die;
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The user card could not be saved. Please, try again.'));
// pr($TempUserCards);die;
}
}
public function checkOrg()
{
$this->autoRender = false;
if ($this->request->is('post')) {
$this->loadModel('MasterOrganizations');
$MasterOrganizations = $this->MasterOrganizations->find('all', [
'fields' => [
'id','org_code',
'org_name_th'
], 'conditions' => [
'org_code' => $this->request->data['organize_code']
]
])->toArray();
if(!empty($MasterOrganizations)){
$data = json_encode($MasterOrganizations);
echo $data;
}else{
echo 'false';
}
}
}
}
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Building Entity
*/
class TempUserCard extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
}
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* UserCard Entity
*
* @property int $id
* @property int $user_id
* @property int $organize_id
* @property string $card_code
* @property string $img_path
* @property string $prefix_name_th
* @property string $firstname_th
* @property string $lastname_th
* @property string $prefix_name_en
* @property string $firstname_en
* @property string $lastname_en
* @property string $department_name
* @property string $section_name
* @property string $position_name
* @property string $gender
* @property string $blood_group
* @property \Cake\I18n\FrozenDate $birthdate
* @property \Cake\I18n\FrozenDate $date_issued
* @property \Cake\I18n\FrozenDate $date_expiry
* @property string $signature
* @property bool $is_used
* @property int $created_by
* @property \Cake\I18n\FrozenTime $created
* @property int $modified_by
* @property \Cake\I18n\FrozenTime $modified
*
* @property \App\Model\Entity\User $user
* @property \App\Model\Entity\Organize $organize
*/
class UserCard extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'user_id' => true,
'organize_id' => true,
'card_code' => true,
'img_path' => true,
'prefix_name_th' => true,
'firstname_th' => true,
'lastname_th' => true,
'prefix_name_en' => true,
'firstname_en' => true,
'lastname_en' => true,
'department_name' => true,
'section_name' => true,
'position_name' => true,
'gender' => true,
'blood_group' => true,
'birthdate' => true,
'date_issued' => true,
'date_expiry' => true,
'signature' => true,
'is_used' => true,
'created_by' => true,
'created' => true,
'modified_by' => true,
'modified' => true,
'user' => true,
'organize' => true
];
}
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
class TempUserCardsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->setTable('temp.user_cards');
$this->setDisplayField('id');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
// $validator
// ->allowEmpty('id', 'create');
// $validator
// ->scalar('building_code')
// ->maxLength('building_code', 20)
// ->requirePresence('building_code', 'create')
// ->notEmpty('building_code');
// $validator
// ->scalar('building_name')
// ->maxLength('building_name', 100)
// ->allowEmpty('building_name');
// $validator
// ->boolean('is_used')
// ->requirePresence('is_used', 'create')
// ->notEmpty('is_used');
// $validator
// ->requirePresence('create_uid', 'create')
// ->notEmpty('create_uid');
// $validator
// ->allowEmpty('update_uid');
// return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
/**
* Returns the database connection name to use by default.
*
* @return string
*/
public static function defaultConnectionName()
{
return 'db_temp';
}
}
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
/**
* UserCards Model
*
* @property \App\Model\Table\UsersTable|\Cake\ORM\Association\BelongsTo $Users
* @property \App\Model\Table\OrganizesTable|\Cake\ORM\Association\BelongsTo $Organizes
*
* @method \App\Model\Entity\UserCard get($primaryKey, $options = [])
* @method \App\Model\Entity\UserCard newEntity($data = null, array $options = [])
* @method \App\Model\Entity\UserCard[] newEntities(array $data, array $options = [])
* @method \App\Model\Entity\UserCard|bool save(\Cake\Datasource\EntityInterface $entity, $options = [])
* @method \App\Model\Entity\UserCard patchEntity(\Cake\Datasource\EntityInterface $entity, array $data, array $options = [])
* @method \App\Model\Entity\UserCard[] patchEntities($entities, array $data, array $options = [])
* @method \App\Model\Entity\UserCard findOrCreate($search, callable $callback = null, $options = [])
*
* @mixin \Cake\ORM\Behavior\TimestampBehavior
*/
class UserCardsTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->setTable('user_cards');
$this->setDisplayField('id');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
$this->belongsTo('Users', [
'foreignKey' => 'user_id',
'joinType' => 'INNER'
]);
$this->belongsTo('Organizes', [
'foreignKey' => 'organize_id'
]);
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
// $validator
// ->allowEmpty('id', 'create');
// $validator
// ->scalar('card_code')
// ->allowEmpty('card_code');
// $validator
// ->scalar('img_path')
// ->allowEmpty('img_path');
// $validator
// ->scalar('prefix_name_th')
// ->allowEmpty('prefix_name_th');
// $validator
// ->scalar('firstname_th')
// ->allowEmpty('firstname_th');
// $validator
// ->scalar('lastname_th')
// ->allowEmpty('lastname_th');
// $validator
// ->scalar('prefix_name_en')
// ->allowEmpty('prefix_name_en');
// $validator
// ->scalar('firstname_en')
// ->allowEmpty('firstname_en');
// $validator
// ->scalar('lastname_en')
// ->allowEmpty('lastname_en');
// $validator
// ->scalar('department_name')
// ->allowEmpty('department_name');
// $validator
// ->scalar('section_name')
// ->allowEmpty('section_name');
// $validator
// ->scalar('position_name')
// ->allowEmpty('position_name');
// $validator
// ->scalar('gender')
// ->allowEmpty('gender');
// $validator
// ->scalar('blood_group')
// ->allowEmpty('blood_group');
// $validator
// ->date('birthdate')
// ->allowEmpty('birthdate');
// $validator
// ->date('date_issued')
// ->allowEmpty('date_issued');
// $validator
// ->date('date_expiry')
// ->allowEmpty('date_expiry');
// $validator
// ->scalar('signature')
// ->allowEmpty('signature');
// $validator
// ->boolean('is_used')
// ->requirePresence('is_used', 'create')
// ->notEmpty('is_used');
// $validator
// ->requirePresence('created_by', 'create')
// ->notEmpty('created_by');
// $validator
// ->allowEmpty('modified_by');
return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
public function buildRules(RulesChecker $rules)
{
// $rules->add($rules->existsIn(['user_id'], 'Users'));
// $rules->add($rules->existsIn(['organize_id'], 'Organizes'));
return $rules;
}
}
<div class="row">
<div style="position: absolute;z-index: 2;">
<a href="../core/Profiles/settingProfile">
<?php echo $this->Html->image('/img/core/img/setting-icon@3x.png', ['alt' => 'setting-icon']); ?>
</a>
</div>
<!------------------------------->
<?php
class QRGenerator {
protected $size;
protected $data;
protected $encoding;
protected $errorCorrectionLevel;
protected $marginInRows;
protected $debug;
public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) {
$this->data=urlencode($data);
$this->size=($size>100 && $size<800)? $size : 300;
$this->encoding=($encoding == 'Shift_JIS' || $encoding == 'ISO-8859-1' || $encoding == 'UTF-8') ? $encoding : 'UTF-8';
$this->errorCorrectionLevel=($errorCorrectionLevel == 'L' || $errorCorrectionLevel == 'M' || $errorCorrectionLevel == 'Q' || $errorCorrectionLevel == 'H') ? $errorCorrectionLevel : 'L';
$this->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4;
$this->debug = ($debug==true)? true:false;
}
public function generate(){
$QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data .
"&choe=" . $this->encoding .
"&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows;
if ($this->debug) echo $QRLink;
return $QRLink;
}
}
?>
<!------------------------------->
<div class="box">
<div class="absolute-right">
<?php echo $this->Html->image('/img/core/img/location-profile-icon@3x.png', ['alt' => 'location-profile-icon']); ?> สีลม ,บางรัก</div>
</div>
<div style="text-align: center;">
<?php if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => 'profile-img','id'=>'output','style'=>'width: 169px;height: 169px;-webkit-border-radius: 85px;
-moz-border-radius: 85px;
border-radius: 85px;')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="profile-img" id="output" style="width: 169px;height: 169px;-webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px;"/>
<?php }?>
</div>
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center;">
<a href="#">
<?php echo $this->Html->image('/img/core/img/id-card-button@3x.png', array('div' => false, 'class' => 'id-card-button')); ?>
</a>
</div>
<div class="bg-profile"></div>
<div style="margin: 11% 0% -12% 0%;text-align: center;position: relative;"><?php echo $this->Flash->render() ?></div>
<div style="padding: 40px 20px 0px 20px;">
<ul class="list list-icons list-primary list-borders">
<li class="promotion-li">
<a href="#">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="../img/core/img/eWallet-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
My eWallet by Connect
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
$150 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
<!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div>
</div>
</a>
</li>
<li class="promotion-li">
<a href="#">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="../img/core/img/point-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
Point ของฉัน
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
P200 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
<!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
<!--------------------------------------------------------->
<style type="text/css">
</style>
<!--------------------------------------------------------->
<style type="text/css">
</style>
<?php //debug($Profiles);?>
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="">
<div class="">
<div class="col-md-6">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1, 'margin': 10}">
<div>
<div class="idcard-profile"><?php echo __('ID Card');?></div>
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<?php if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => '','style' => 'position: absolute;width: 150px; margin: 85% 0% 0% 20%; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="" id="" style="position: absolute;width: 150px; height: 150px; margin: 85% 0% 0% 20%; -webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);"/>
<?php }?>
<div class="idcard-text"><?php echo __('เลขบัตรประจำตัว');?></div>
<div class="idcard-number"><?php echo $Profiles['UserProfiles'][0]['card_code'];?></div>
<div class="idcard-name-th"><?php echo $Profiles['UserPersonals']['firstname_th'];?> <?php echo $Profiles['UserPersonals']['lastname_th'];?></div>
<div class="idcard-name-en"><?php echo $Profiles['UserPersonals']['firstname_en'];?> <?php echo $Profiles['UserPersonals']['lastname_en'];?></div>
<?php if (!empty($Profiles['UserProfiles'][0]['dept_id'])) { ?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo $MasterDepartments_v[0]['dept_name_th'];?></div>
<?php }else{?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo __('-');?></div>
<?php }?>
<?php if (!empty($Profiles['UserProfiles'][0]['section_id'])) { ?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo $MasterSections_v[0]['section_name_th'];?></div>
<?php }else{?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo __('-');?></div>
<?php }?>
<!-- <div class="idcard-faculty"><b><?php //echo __('คณะ');?></b> <?php //echo __('วิทยาการจัดการ');?></div>
<div class="idcard-branch"><b><?php //echo __('สาขา');?></b> <?php //echo __('คอมพิวเตอร์ธุรกิจ');?></div>-->
<div class="idcard-tel"><b><?php echo __('เบอร์');?></b> <?php echo $Profiles['UserProfiles'][0]['phone_no'];?></div>
<div class="idcard-email"><b><?php echo __('email');?></b> <?php echo $Profiles['UserPersonals']['email'];?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -4px 0px 0px 96px;')); ?>
</div>
<div>
<div class="qrcode-profile"><?php echo __('แสดง QR Code เพื่อรับสิทธิ์');?></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 class="qrcode-name">
<?php
$ex1 = new QRGenerator();
echo "<img src=".$ex1->generate()." style='position: absolute;width: 150px;border: solid 1px #000;' class='qrcode-name'>";
?>
<?php //echo $this->Html->image('/img/core/img/qr-code.jpg', array('div' => false, 'class' => 'qrcode-name','style' => 'position: absolute;width: 120px;')); ?>
</div>
<div class="qrcode-faculty"><?php echo __('Date of Issue');?> <?php echo date("m/Y",strtotime($Profiles['Users']['created']));?></div>
<div class="qrcode-branch">| &nbsp;&nbsp;<?php echo __('Date of Expire');?> <?php echo date("m/Y",strtotime($Profiles['Users']['token_expiry'])); ?></div>
<?php echo $this->Html->image('/img/core/img/card-university-logo.png', array('div' => false, 'class' => '','style' => 'width: 25px;position: absolute;margin: -17% 0% 0% 86%;')); ?>
<?php if (!empty($Profiles['UserProfiles'][0]['organize_id'])) { ?>
<div class="qrcode-university"><?php echo $MasterDepartmentEducations[0]['org_name_th'];?></div>
<?php }else{?>
<div class="qrcode-university"><?php echo __('-');?></div>
<?php }?>
<?php //echo __('มหาวิทยาลัยราชภัฏจันทรเกษม');?>
<?php echo $this->Html->image('/img/core/img/card-logo-connect.png', array('div' => false, 'class' => '','style' => 'width: 26px;position: absolute;margin: -114% 0% 0% 86%;')); ?>
<div class="qrcode-connect"><?php echo __('connect');?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id2@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -152% 0% 0% 28%;')); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!------------------------------------------------------------------------------->
<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="../core/Profiles/settingProfile">
<?php echo $this->Html->image('/img/core/img/setting-icon@3x.png', ['alt' => 'setting-icon']); ?>
</a>
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a>
</div>
<!------------------------------->
<?php
class QRGenerator {
protected $size;
protected $data;
protected $encoding;
protected $errorCorrectionLevel;
protected $marginInRows;
protected $debug;
public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) {
$this->data=urlencode($data);
$this->size=($size>100 && $size<800)? $size : 300;
$this->encoding=($encoding == 'Shift_JIS' || $encoding == 'ISO-8859-1' || $encoding == 'UTF-8') ? $encoding : 'UTF-8';
$this->errorCorrectionLevel=($errorCorrectionLevel == 'L' || $errorCorrectionLevel == 'M' || $errorCorrectionLevel == 'Q' || $errorCorrectionLevel == 'H') ? $errorCorrectionLevel : 'L';
$this->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4;
$this->debug = ($debug==true)? true:false;
}
public function generate(){
$QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data .
"&choe=" . $this->encoding .
"&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows;
if ($this->debug) echo $QRLink;
return $QRLink;
}
}
?>
<!------------------------------->
<div class="box">
<div class="absolute-right">
<?php echo $this->Html->image('/img/core/img/location-profile-icon@3x.png', ['alt' => 'location-profile-icon']); ?> สีลม ,บางรัก</div>
<div class="box">
<div class="absolute-right"><img src="/img/core/img/location-profile-icon@3x.png"/> สีลม ,บางรัก</div>
</div>
<div style="text-align: center;">
<?php if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => 'profile-img','id'=>'output','style'=>'width: 169px;height: 169px;-webkit-border-radius: 85px;
-moz-border-radius: 85px;
border-radius: 85px;')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="profile-img" id="output" style="width: 169px;height: 169px;-webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px;"/>
<?php }?>
</div>
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center;">
<a href="#">
<?php echo $this->Html->image('/img/core/img/id-card-button@3x.png', array('div' => false, 'class' => 'id-card-button')); ?>
</a>
<!--<div class="">-->
<?php //echo @$this->Html->image($responseUserProfile['UserProfiles']['img_path'], ['class' => 'imgCircle profile-img', 'id' => 'img-upload', 'alt' => 'Profile picture']); ?>
<!-- <img src="/porto/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture"> -->
<img src="/img/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture">
<!--</div>-->
<input type="file" id="uploadProfile" class="profile-img form-control form-input Profile-input-file" name="data[UserProfiles][img_path]" >
</div>
<div class="bg-profile"></div>
<div style="margin: 11% 0% -12% 0%;text-align: center;position: relative;"><?php echo $this->Flash->render() ?></div>
<div style="padding: 40px 20px 0px 20px;">
<ul class="list list-icons list-primary list-borders">
<li class="promotion-li">
<a href="#">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="../img/core/img/eWallet-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
My eWallet by Connect
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
$150 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
<!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div>
</div>
</a>
</li>
<li class="promotion-li">
<a href="#">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="../img/core/img/point-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
Point ของฉัน
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
P200 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
<!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div>
</div>
</a>
</li>
</ul>
<div class="bg-profile"></div>
<!--<div class="col-xs-12 col-sm-12 col-md-12" style="padding-top: 20px;">-->
<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']); ?>
<?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME', 'readonly']); ?>
<?php // echo $this->Form->input('user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $userProfile->username, 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
</div>
</div>
<?php // foreach ($userProfile->user['user_personals'] as $k => $userProfiles): ?>
<?php // debug($userProfiles); exit;?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<!--<label class="label-text-sub">เพศ</label>-->
<?php echo __('เพศ'); ?>
<div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserProfile['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('ชาย'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserProfile['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('หญิง'); ?>
</label>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ', 'required']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล', 'required']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from required', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => __('วันเดือนปีเกิด'), 'placeholder' => 'DD-MM-YYYY', 'required']); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('กรุ๊ปเลือด'); ?>
<div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-A" value="A" <?php echo ($responseUserProfile['blood_group'] == 'A') ? 'checked="checked"' : null; ?>> <?php echo __('A'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-B" value="B" <?php echo ($responseUserProfile['blood_group'] == 'B') ? 'checked="checked"' : null; ?>> <?php echo __('B'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-AB" value="AB" <?php echo ($responseUserProfile['blood_group'] == 'AB') ? 'checked="checked"' : null; ?>> <?php echo __('AB'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-O" value="O" <?php echo ($responseUserProfile['blood_group'] == 'O') ? 'checked="checked"' : null; ?>> <?php echo __('O'); ?>
</label>
</div>
</div>
<!--------------------------------------------------------->
<style type="text/css">
</style>
<!--------------------------------------------------------->
<style type="text/css">
</style>
<?php //debug($Profiles);?>
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="">
<div class="">
<div class="col-md-6">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1, 'margin': 10}">
<div>
<div class="idcard-profile"><?php echo __('ID Card');?></div>
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<?php if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => '','style' => 'position: absolute;width: 150px; margin: 85% 0% 0% 20%; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="" id="" style="position: absolute;width: 150px; height: 150px; margin: 85% 0% 0% 20%; -webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);"/>
<?php }?>
<div class="idcard-text"><?php echo __('เลขบัตรประจำตัว');?></div>
<div class="idcard-number"><?php echo $Profiles['UserProfiles'][0]['card_code'];?></div>
<div class="idcard-name-th"><?php echo $Profiles['UserPersonals']['firstname_th'];?> <?php echo $Profiles['UserPersonals']['lastname_th'];?></div>
<div class="idcard-name-en"><?php echo $Profiles['UserPersonals']['firstname_en'];?> <?php echo $Profiles['UserPersonals']['lastname_en'];?></div>
<?php if (!empty($Profiles['UserProfiles'][0]['dept_id'])) { ?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo $MasterDepartments_v[0]['dept_name_th'];?></div>
<?php }else{?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo __('-');?></div>
<?php }?>
<?php if (!empty($Profiles['UserProfiles'][0]['section_id'])) { ?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo $MasterSections_v[0]['section_name_th'];?></div>
<?php }else{?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo __('-');?></div>
<?php }?>
<!-- <div class="idcard-faculty"><b><?php //echo __('คณะ');?></b> <?php //echo __('วิทยาการจัดการ');?></div>
<div class="idcard-branch"><b><?php //echo __('สาขา');?></b> <?php //echo __('คอมพิวเตอร์ธุรกิจ');?></div>-->
<div class="idcard-tel"><b><?php echo __('เบอร์');?></b> <?php echo $Profiles['UserProfiles'][0]['phone_no'];?></div>
<div class="idcard-email"><b><?php echo __('email');?></b> <?php echo $Profiles['UserPersonals']['email'];?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -4px 0px 0px 96px;')); ?>
</div>
<div>
<div class="qrcode-profile"><?php echo __('แสดง QR Code เพื่อรับสิทธิ์');?></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 class="qrcode-name">
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['email'], 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['address'], 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
<?php // echo $this->Form->input('address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->address, 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('ประเทศ'); ?>
<?php
$ex1 = new QRGenerator();
echo "<img src=".$ex1->generate()." style='position: absolute;width: 150px;border: solid 1px #000;' class='qrcode-name'>";
echo $this->Form->input( 'master_country_id', array(
'id' => 'master_country_id',
'label' => false,
'type' => 'select',
'options' => $Country,
'value' => $responseUserProfile['master_country_id'],
'empty' => '---Select---',
'default' => !empty($responseUserProfile['master_country_id'])? $responseUserProfile['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub required',
'style' => 'width:100%'
));
?>
<?php //echo $this->Html->image('/img/core/img/qr-code.jpg', array('div' => false, 'class' => 'qrcode-name','style' => 'position: absolute;width: 120px;')); ?>
</div>
<div class="qrcode-faculty"><?php echo __('Date of Issue');?> <?php echo date("m/Y",strtotime($Profiles['Users']['created']));?></div>
<div class="qrcode-branch">| &nbsp;&nbsp;<?php echo __('Date of Expire');?> <?php echo date("m/Y",strtotime($Profiles['Users']['token_expiry'])); ?></div>
<?php echo $this->Html->image('/img/core/img/card-university-logo.png', array('div' => false, 'class' => '','style' => 'width: 25px;position: absolute;margin: -17% 0% 0% 86%;')); ?>
<?php if (!empty($Profiles['UserProfiles'][0]['organize_id'])) { ?>
<div class="qrcode-university"><?php echo $MasterDepartmentEducations[0]['org_name_th'];?></div>
<?php }else{?>
<div class="qrcode-university"><?php echo __('-');?></div>
<?php }?>
<?php //echo __('มหาวิทยาลัยราชภัฏจันทรเกษม');?>
<?php echo $this->Html->image('/img/core/img/card-logo-connect.png', array('div' => false, 'class' => '','style' => 'width: 26px;position: absolute;margin: -114% 0% 0% 86%;')); ?>
<div class="qrcode-connect"><?php echo __('connect');?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id2@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -152% 0% 0% 28%;')); ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('จังหวัด'); ?>
<?php
echo $this->Form->input( 'master_province_id', array(
'id' => 'master_province_id',
'label' => false,
'type' => 'select',
'options' => $Province,
'value' => $responseUserProfile['master_province_id'],
'empty' => '---Select---',
'default' => !empty($responseUserProfile['master_province_id'])? $responseUserProfile['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub required',
'style' => 'width:100%'
));
?>
</div>
</div>
<?php // endforeach; ?>
<div>
<?php // echo $this->Form->submit(__('SAVE')) ?>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile">บันทึก</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
</div>
<!------------------------------------------------------------------------------->
<script type="text/javascript">
$(function () {
$('#moblieNo').inputmask('999-999-9999');
$('#officePhone').inputmask('99-999-9999');
//==================================================
// CHANGE UNIVERSITY PROFILES
//==================================================
$("#OrganizetionId").change(function () {
getDepartment();
});
$("#DepartmentId").change(function () {
getSection();
});
$("#SectionId").change(function () {
updateChosen();
});
//==================================================
// CHANGE COMPAMY PROFILES
//==================================================
$("#companyName").change(function () {
getCompanyDepartment();
});
$("#department").change(function () {
getCompanySection();
});
$("#cottonId").change(function () {
getCompanyPosition();
});
$(".datepicker").change(function () {
updateChosen();
});
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
//==================================================
// CHANGE PROFILES PICTURE
//==================================================
$("#uploadProfile").change(function () {
readURL(this);
});
});
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#img-upload')
.attr('src', e.target.result)
.width(150)
.height(150);
}
reader.readAsDataURL(input.files[0]);
}
}
//==================================================
// CHANGE Province According Country
//==================================================
$(document).ready(function() {
$("#loding1").hide();
$("#loding2").hide();
$("#master_country_id").on('change',function() {
var id = $(this).val();
$("#loding1").show();
$("#master_province_id").find('option').remove();
if (id) {
var dataString = 'id='+ id;
$.ajax({
type: "POST",
url: '/Profiles/index',
data: dataString,
cache: false,
success: function(html) {
$("#loding1").hide();
$.each(html, function(key, value) {
$('<option>').val('').text('select');
$('<option>').val(key).text(value).appendTo($("#master_province_id"));
});
}
});
}
});
});
</script>
\ No newline at end of file
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\UserCard $userCard
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('List User Cards'), ['action' => 'index']) ?></li>
<li><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?></li>
</ul>
</nav>
<div class="userCards form large-9 medium-8 columns content">
<?= $this->Form->create($userCard) ?>
<fieldset>
<legend><?= __('Add User Card') ?></legend>
<?php
echo $this->Form->control('user_id', ['options' => $users]);
echo $this->Form->control('organize_id');
echo $this->Form->control('card_code');
echo $this->Form->control('img_path');
echo $this->Form->control('prefix_name_th');
echo $this->Form->control('firstname_th');
echo $this->Form->control('lastname_th');
echo $this->Form->control('prefix_name_en');
echo $this->Form->control('firstname_en');
echo $this->Form->control('lastname_en');
echo $this->Form->control('department_name');
echo $this->Form->control('section_name');
echo $this->Form->control('position_name');
echo $this->Form->control('gender');
echo $this->Form->control('blood_group');
echo $this->Form->control('birthdate', ['empty' => true]);
echo $this->Form->control('date_issued', ['empty' => true]);
echo $this->Form->control('date_expiry', ['empty' => true]);
echo $this->Form->control('signature');
echo $this->Form->control('is_used');
echo $this->Form->control('created_by');
echo $this->Form->control('modified_by');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserCrads', ['id' => 'frmSignIn', 'type' => 'file', 'onsubmit' => 'return check();']); ?>
<div style="position: absolute;z-index: 2;">
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a>
</div>
<div style="text-align: center;">
<input type="file" id="uploadProfile" class="profile-img form-control form-input Profile-input-file" name="data[UserProfiles][img_path]" >
</div>
<div class="bg-profile"></div>
<!--<div class="col-xs-12 col-sm-12 col-md-12" style="padding-top: 20px;">-->
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->hidden('UserCards.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'userId', 'type' => 'text', 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->hidden('UserCards.organize_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_id', 'type' => 'text', 'label' => __('ไอดีใช้งาน'), 'placeholder' => 'USERNAME', 'required']); ?>
<?php echo $this->Form->input('UserCards.organize_code', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_code', 'type' => 'text', 'label' => __('Company Code'), 'placeholder' => 'Company Code', 'required']); ?>
<label id = "nameorg_th" style="color: green"></label>
<label id = "noorg_th" style="color: red"></label>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserCards.employee', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'employee', 'type' => 'text', 'label' => __('รหัสพนักงาน / รหัสนักศึกษา'), 'placeholder' => 'รหัสพนักงาน / รหัสนักศึกษา', 'disabled', 'required']); ?>
</div>
</div>
<div class="form-group has-feedback bootstrap-iso">
<div class="col-xs-12 col-sm-12 col-md-12">
<!-- <?php echo $this->Form->input('UserCards.birthdate', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'birthdate', 'type' => 'daet', 'label' => __('วันเกิด'), 'placeholder' => '01/01/2000', 'disabled', 'required']); ?> -->
<label class="label-text-sub"><?php echo __('วันเกิด');?></label>
<input type="text" name="UserCards[birthdate]" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from">
<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div>
</div>
<div>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile">บันทึก</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
</div>
<script>
var organize_id = document.getElementById("organize_id");
var employee = document.getElementById("employee");
var date = document.getElementById("date");
$(document).ready(function() {
$("#organize_code").on('change',function(){
var organize_code = document.getElementById("organize_code").value
alert(organize_code);
$.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) {
if(data!='false'){
data = jQuery.parseJSON(data);
console.log(data);
$("#nameorg_th").text(data[0]['org_name_th']);
$("#noorg_th").text('');
$("#employee").removeAttr("disabled");
$("#date").removeAttr("disabled");
organize_id.value = data[0]['id'];
}else{
$("#noorg_th").text('ไม่พบข้อมูล');
$("#nameorg_th").text('');
$('#employee').attr("disabled",true);
$('#date').attr("disabled",true);
organize_id.value = '';
employee.value = '';
date.value = '';
}
});
});
});
function check() {
if (employee.value == '') {
alert("รหัสพนักงาน / รหัสนักศึกษา");
employee.focus();
return false;
}
if (date.value == '') {
alert("วันเกิด");
date.focus();
return false;
}
}
</script>
<script>
$(document).ready(function(){
var date_input=$('input[id="date"]'); //our date input has the name "date"
var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
var options={
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
};
date_input.datepicker(options);
})
</script>
\ No newline at end of file
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\UserCard $userCard
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Form->postLink(
__('Delete'),
['action' => 'delete', $userCard->id],
['confirm' => __('Are you sure you want to delete # {0}?', $userCard->id)]
)
?></li>
<li><?= $this->Html->link(__('List User Cards'), ['action' => 'index']) ?></li>
<li><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?></li>
</ul>
</nav>
<div class="userCards form large-9 medium-8 columns content">
<?= $this->Form->create($userCard) ?>
<fieldset>
<legend><?= __('Edit User Card') ?></legend>
<?php
echo $this->Form->control('user_id', ['options' => $users]);
echo $this->Form->control('organize_id');
echo $this->Form->control('card_code');
echo $this->Form->control('img_path');
echo $this->Form->control('prefix_name_th');
echo $this->Form->control('firstname_th');
echo $this->Form->control('lastname_th');
echo $this->Form->control('prefix_name_en');
echo $this->Form->control('firstname_en');
echo $this->Form->control('lastname_en');
echo $this->Form->control('department_name');
echo $this->Form->control('section_name');
echo $this->Form->control('position_name');
echo $this->Form->control('gender');
echo $this->Form->control('blood_group');
echo $this->Form->control('birthdate', ['empty' => true]);
echo $this->Form->control('date_issued', ['empty' => true]);
echo $this->Form->control('date_expiry', ['empty' => true]);
echo $this->Form->control('signature');
echo $this->Form->control('is_used');
echo $this->Form->control('created_by');
echo $this->Form->control('modified_by');
?>
</fieldset>
<?= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\UserCard[]|\Cake\Collection\CollectionInterface $userCards
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('New User Card'), ['action' => 'add']) ?></li>
<li><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?></li>
<li><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?></li>
</ul>
</nav>
<div class="userCards index large-9 medium-8 columns content">
<h3><?= __('User Cards') ?></h3>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('user_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('organize_id') ?></th>
<th scope="col"><?= $this->Paginator->sort('card_code') ?></th>
<th scope="col"><?= $this->Paginator->sort('img_path') ?></th>
<th scope="col"><?= $this->Paginator->sort('prefix_name_th') ?></th>
<th scope="col"><?= $this->Paginator->sort('firstname_th') ?></th>
<th scope="col"><?= $this->Paginator->sort('lastname_th') ?></th>
<th scope="col"><?= $this->Paginator->sort('prefix_name_en') ?></th>
<th scope="col"><?= $this->Paginator->sort('firstname_en') ?></th>
<th scope="col"><?= $this->Paginator->sort('lastname_en') ?></th>
<th scope="col"><?= $this->Paginator->sort('department_name') ?></th>
<th scope="col"><?= $this->Paginator->sort('section_name') ?></th>
<th scope="col"><?= $this->Paginator->sort('position_name') ?></th>
<th scope="col"><?= $this->Paginator->sort('gender') ?></th>
<th scope="col"><?= $this->Paginator->sort('blood_group') ?></th>
<th scope="col"><?= $this->Paginator->sort('birthdate') ?></th>
<th scope="col"><?= $this->Paginator->sort('date_issued') ?></th>
<th scope="col"><?= $this->Paginator->sort('date_expiry') ?></th>
<th scope="col"><?= $this->Paginator->sort('signature') ?></th>
<th scope="col"><?= $this->Paginator->sort('is_used') ?></th>
<th scope="col"><?= $this->Paginator->sort('created_by') ?></th>
<th scope="col"><?= $this->Paginator->sort('created') ?></th>
<th scope="col"><?= $this->Paginator->sort('modified_by') ?></th>
<th scope="col"><?= $this->Paginator->sort('modified') ?></th>
<th scope="col" class="actions"><?= __('Actions') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($userCards as $userCard): ?>
<tr>
<td><?= $this->Number->format($userCard->id) ?></td>
<td><?= $userCard->has('user') ? $this->Html->link($userCard->user->username, ['controller' => 'Users', 'action' => 'view', $userCard->user->id]) : '' ?></td>
<td><?= $this->Number->format($userCard->organize_id) ?></td>
<td><?= h($userCard->card_code) ?></td>
<td><?= h($userCard->img_path) ?></td>
<td><?= h($userCard->prefix_name_th) ?></td>
<td><?= h($userCard->firstname_th) ?></td>
<td><?= h($userCard->lastname_th) ?></td>
<td><?= h($userCard->prefix_name_en) ?></td>
<td><?= h($userCard->firstname_en) ?></td>
<td><?= h($userCard->lastname_en) ?></td>
<td><?= h($userCard->department_name) ?></td>
<td><?= h($userCard->section_name) ?></td>
<td><?= h($userCard->position_name) ?></td>
<td><?= h($userCard->gender) ?></td>
<td><?= h($userCard->blood_group) ?></td>
<td><?= h($userCard->birthdate) ?></td>
<td><?= h($userCard->date_issued) ?></td>
<td><?= h($userCard->date_expiry) ?></td>
<td><?= h($userCard->signature) ?></td>
<td><?= h($userCard->is_used) ?></td>
<td><?= $this->Number->format($userCard->created_by) ?></td>
<td><?= h($userCard->created) ?></td>
<td><?= $this->Number->format($userCard->modified_by) ?></td>
<td><?= h($userCard->modified) ?></td>
<td class="actions">
<?= $this->Html->link(__('View'), ['action' => 'view', $userCard->id]) ?>
<?= $this->Html->link(__('Edit'), ['action' => 'edit', $userCard->id]) ?>
<?= $this->Form->postLink(__('Delete'), ['action' => 'delete', $userCard->id], ['confirm' => __('Are you sure you want to delete # {0}?', $userCard->id)]) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
</div>
</div>
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\UserCard $userCard
*/
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Edit User Card'), ['action' => 'edit', $userCard->id]) ?> </li>
<li><?= $this->Form->postLink(__('Delete User Card'), ['action' => 'delete', $userCard->id], ['confirm' => __('Are you sure you want to delete # {0}?', $userCard->id)]) ?> </li>
<li><?= $this->Html->link(__('List User Cards'), ['action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('New User Card'), ['action' => 'add']) ?> </li>
<li><?= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?> </li>
<li><?= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?> </li>
</ul>
</nav>
<div class="userCards view large-9 medium-8 columns content">
<h3><?= h($userCard->id) ?></h3>
<table class="vertical-table">
<tr>
<th scope="row"><?= __('User') ?></th>
<td><?= $userCard->has('user') ? $this->Html->link($userCard->user->username, ['controller' => 'Users', 'action' => 'view', $userCard->user->id]) : '' ?></td>
</tr>
<tr>
<th scope="row"><?= __('Card Code') ?></th>
<td><?= h($userCard->card_code) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Img Path') ?></th>
<td><?= h($userCard->img_path) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Prefix Name Th') ?></th>
<td><?= h($userCard->prefix_name_th) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Firstname Th') ?></th>
<td><?= h($userCard->firstname_th) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Lastname Th') ?></th>
<td><?= h($userCard->lastname_th) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Prefix Name En') ?></th>
<td><?= h($userCard->prefix_name_en) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Firstname En') ?></th>
<td><?= h($userCard->firstname_en) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Lastname En') ?></th>
<td><?= h($userCard->lastname_en) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Department Name') ?></th>
<td><?= h($userCard->department_name) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Section Name') ?></th>
<td><?= h($userCard->section_name) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Position Name') ?></th>
<td><?= h($userCard->position_name) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Gender') ?></th>
<td><?= h($userCard->gender) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Blood Group') ?></th>
<td><?= h($userCard->blood_group) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Signature') ?></th>
<td><?= h($userCard->signature) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Id') ?></th>
<td><?= $this->Number->format($userCard->id) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Organize Id') ?></th>
<td><?= $this->Number->format($userCard->organize_id) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Created By') ?></th>
<td><?= $this->Number->format($userCard->created_by) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Modified By') ?></th>
<td><?= $this->Number->format($userCard->modified_by) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Birthdate') ?></th>
<td><?= h($userCard->birthdate) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Date Issued') ?></th>
<td><?= h($userCard->date_issued) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Date Expiry') ?></th>
<td><?= h($userCard->date_expiry) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Created') ?></th>
<td><?= h($userCard->created) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Modified') ?></th>
<td><?= h($userCard->modified) ?></td>
</tr>
<tr>
<th scope="row"><?= __('Is Used') ?></th>
<td><?= $userCard->is_used ? __('Yes') : __('No'); ?></td>
</tr>
</table>
</div>
<?php
namespace App\Test\Fixture;
use Cake\TestSuite\Fixture\TestFixture;
/**
* UserCardsFixture
*
*/
class UserCardsFixture extends TestFixture
{
/**
* Fields
*
* @var array
*/
// @codingStandardsIgnoreStart
public $fields = [
'id' => ['type' => 'biginteger', 'length' => 20, 'autoIncrement' => true, 'default' => null, 'null' => false, 'comment' => null, 'precision' => null, 'unsigned' => null],
'user_id' => ['type' => 'biginteger', 'length' => 20, 'default' => null, 'null' => false, 'comment' => 'รหัส user', 'precision' => null, 'unsigned' => null, 'autoIncrement' => null],
'organize_id' => ['type' => 'biginteger', 'length' => 20, 'default' => null, 'null' => true, 'comment' => 'รหัส บริษัท', 'precision' => null, 'unsigned' => null, 'autoIncrement' => null],
'card_code' => ['type' => 'string', 'length' => 20, 'default' => null, 'null' => true, 'collate' => null, 'comment' => 'หมายเลขบัตร', 'precision' => null, 'fixed' => null],
'img_path' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'prefix_name_th' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => 'ฝ่าย', 'precision' => null, 'fixed' => null],
'firstname_th' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'lastname_th' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'prefix_name_en' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'firstname_en' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'lastname_en' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'department_name' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'section_name' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => 'แผนก', 'precision' => null, 'fixed' => null],
'position_name' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => 'ตำแหน่ง', 'precision' => null, 'fixed' => null],
'gender' => ['type' => 'string', 'length' => 1, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'blood_group' => ['type' => 'string', 'length' => 1, 'default' => null, 'null' => true, 'collate' => null, 'comment' => null, 'precision' => null, 'fixed' => null],
'birthdate' => ['type' => 'date', 'length' => null, 'default' => null, 'null' => true, 'comment' => null, 'precision' => null],
'date_issued' => ['type' => 'date', 'length' => null, 'default' => null, 'null' => true, 'comment' => 'วันที่ ออกบัตร', 'precision' => null],
'date_expiry' => ['type' => 'date', 'length' => null, 'default' => null, 'null' => true, 'comment' => 'วันที่ หมดอายุ', 'precision' => null],
'signature' => ['type' => 'string', 'length' => 255, 'default' => null, 'null' => true, 'collate' => null, 'comment' => 'ลายเซ็น', 'precision' => null, 'fixed' => null],
'is_used' => ['type' => 'boolean', 'length' => null, 'default' => null, 'null' => false, 'comment' => null, 'precision' => null],
'created_by' => ['type' => 'biginteger', 'length' => 20, 'default' => null, 'null' => false, 'comment' => null, 'precision' => null, 'unsigned' => null, 'autoIncrement' => null],
'created' => ['type' => 'timestamp', 'length' => null, 'default' => null, 'null' => false, 'comment' => null, 'precision' => null],
'modified_by' => ['type' => 'biginteger', 'length' => 20, 'default' => null, 'null' => true, 'comment' => null, 'precision' => null, 'unsigned' => null, 'autoIncrement' => null],
'modified' => ['type' => 'timestamp', 'length' => null, 'default' => null, 'null' => true, 'comment' => null, 'precision' => null],
'_constraints' => [
'primary' => ['type' => 'primary', 'columns' => ['id'], 'length' => []],
],
];
// @codingStandardsIgnoreEnd
/**
* Records
*
* @var array
*/
public $records = [
[
'id' => 1,
'user_id' => 1,
'organize_id' => 1,
'card_code' => 'Lorem ipsum dolor ',
'img_path' => 'Lorem ipsum dolor sit amet',
'prefix_name_th' => 'Lorem ipsum dolor sit amet',
'firstname_th' => 'Lorem ipsum dolor sit amet',
'lastname_th' => 'Lorem ipsum dolor sit amet',
'prefix_name_en' => 'Lorem ipsum dolor sit amet',
'firstname_en' => 'Lorem ipsum dolor sit amet',
'lastname_en' => 'Lorem ipsum dolor sit amet',
'department_name' => 'Lorem ipsum dolor sit amet',
'section_name' => 'Lorem ipsum dolor sit amet',
'position_name' => 'Lorem ipsum dolor sit amet',
'gender' => 'Lorem ipsum dolor sit ame',
'blood_group' => 'Lorem ipsum dolor sit ame',
'birthdate' => '2018-05-15',
'date_issued' => '2018-05-15',
'date_expiry' => '2018-05-15',
'signature' => 'Lorem ipsum dolor sit amet',
'is_used' => 1,
'created_by' => 1,
'created' => 1526366122,
'modified_by' => 1,
'modified' => 1526366122
],
];
}
<?php
namespace App\Test\TestCase\Controller;
use App\Controller\UserCardsController;
use Cake\TestSuite\IntegrationTestCase;
/**
* App\Controller\UserCardsController Test Case
*/
class UserCardsControllerTest extends IntegrationTestCase
{
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.user_cards',
'app.users',
'app.article_likes',
'app.article_take_questions',
'app.user_default_languages',
'app.user_homeplaces',
'app.user_personals',
'app.user_profiles',
'app.organizes'
];
/**
* Test index method
*
* @return void
*/
public function testIndex()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test view method
*
* @return void
*/
public function testView()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test add method
*
* @return void
*/
public function testAdd()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test edit method
*
* @return void
*/
public function testEdit()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test delete method
*
* @return void
*/
public function testDelete()
{
$this->markTestIncomplete('Not implemented yet.');
}
}
<?php
namespace App\Test\TestCase\Model\Table;
use App\Model\Table\UserCardsTable;
use Cake\ORM\TableRegistry;
use Cake\TestSuite\TestCase;
/**
* App\Model\Table\UserCardsTable Test Case
*/
class UserCardsTableTest extends TestCase
{
/**
* Test subject
*
* @var \App\Model\Table\UserCardsTable
*/
public $UserCards;
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.user_cards',
'app.users',
'app.article_likes',
'app.article_take_questions',
'app.user_default_languages',
'app.user_homeplaces',
'app.user_personals',
'app.user_profiles',
'app.organizes'
];
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
$config = TableRegistry::exists('UserCards') ? [] : ['className' => UserCardsTable::class];
$this->UserCards = TableRegistry::get('UserCards', $config);
}
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
unset($this->UserCards);
parent::tearDown();
}
/**
* Test initialize method
*
* @return void
*/
public function testInitialize()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test validationDefault method
*
* @return void
*/
public function testValidationDefault()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test buildRules method
*
* @return void
*/
public function testBuildRules()
{
$this->markTestIncomplete('Not implemented yet.');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment