Commit da2390a3 authored by hr cloud's avatar hr cloud
Browse files

up

parent 24f1e323
/*
SQLyog Ultimate v12.4.3 (64 bit)
MySQL - 5.7.34-0ubuntu0.18.04.1 : Database - pelatihan_gtfw
MySQL - 5.7.34-0ubuntu0.18.04.1 : Database - pelatihan_gtfw_2
*********************************************************************
*/
......@@ -12,9 +12,9 @@ MySQL - 5.7.34-0ubuntu0.18.04.1 : Database - pelatihan_gtfw
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`pelatihan_gtfw` /*!40100 DEFAULT CHARACTER SET latin1 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`pelatihan_gtfw_2` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `pelatihan_gtfw`;
USE `pelatihan_gtfw_2`;
/*Table structure for table `comp_email_history` */
......@@ -1053,7 +1053,7 @@ CREATE TABLE `gtfw_group` (
/*Data for the table `gtfw_group` */
insert into `gtfw_group`(`group_id`,`group_name`,`group_desc`,`group_application_id`,`insert_user_id`,`insert_timestamp`,`update_user_id`,`update_timestamp`) values
(1,'Administrator (Root)','',1,NULL,'0000-00-00 00:00:00',1,'2014-02-18 01:38:32');
(1,'Administrator (Root)','',1,NULL,'0000-00-00 00:00:00',1,'2021-07-19 11:10:03');
/*Table structure for table `gtfw_group_menu` */
......@@ -1108,7 +1108,10 @@ insert into `gtfw_group_menu`(`groupmenu_menu_id`,`groupmenu_group_id`) values
(34,1),
(35,1),
(36,1),
(37,1);
(37,1),
(38,1),
(39,1),
(40,1);
/*Table structure for table `gtfw_group_module` */
......@@ -1410,7 +1413,23 @@ insert into `gtfw_group_module`(`groupmodule_group_id`,`groupmodule_module_id`)
(1,422),
(1,423),
(1,424),
(1,425);
(1,425),
(1,426),
(1,427),
(1,428),
(1,429),
(1,430),
(1,431),
(1,432),
(1,433),
(1,434),
(1,435),
(1,436),
(1,437),
(1,438),
(1,439),
(1,440),
(1,441);
/*Table structure for table `gtfw_key` */
......@@ -1426,7 +1445,7 @@ CREATE TABLE `gtfw_key` (
`update_timestamp` datetime DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`key_id`),
UNIQUE KEY `Index_key` (`key_code`)
) ENGINE=InnoDB AUTO_INCREMENT=2441 DEFAULT CHARSET=latin1;
) ENGINE=InnoDB AUTO_INCREMENT=2444 DEFAULT CHARSET=latin1;
/*Data for the table `gtfw_key` */
......@@ -3835,7 +3854,10 @@ insert into `gtfw_key`(`key_id`,`key_code`,`key_desc`,`insert_user_id`,`insert_
(2437,'polling_info',NULL,1,'2013-12-30 09:19:06',NULL,'0000-00-00 00:00:00'),
(2438,'submit_poll',NULL,1,'2013-12-30 09:20:35',1,'2013-12-30 14:16:06'),
(2439,'polling',NULL,1,'2013-12-30 14:56:12',NULL,'0000-00-00 00:00:00'),
(2440,'import',NULL,1,'2014-02-04 08:54:06',NULL,'0000-00-00 00:00:00');
(2440,'import',NULL,1,'2014-02-04 08:54:06',NULL,'0000-00-00 00:00:00'),
(2441,'tblprovince',NULL,1,'2021-07-19 10:33:24',NULL,'0000-00-00 00:00:00'),
(2442,'created',NULL,1,'2021-07-19 10:39:42',NULL,'0000-00-00 00:00:00'),
(2443,'excel',NULL,1,'2021-07-19 10:50:13',NULL,'0000-00-00 00:00:00');
/*Table structure for table `gtfw_key_text` */
......@@ -8668,7 +8690,13 @@ insert into `gtfw_key_text`(`key_text_key_id`,`key_text_lang_code`,`key_text_ke
(2439,'en','Polling',1,'2013-12-30 14:56:12',NULL,'0000-00-00 00:00:00'),
(2439,'id','Polling',1,'2013-12-30 14:56:12',NULL,'0000-00-00 00:00:00'),
(2440,'en','Import',1,'2014-02-04 08:54:06',NULL,'0000-00-00 00:00:00'),
(2440,'id','Import',1,'2014-02-04 08:54:06',NULL,'0000-00-00 00:00:00');
(2440,'id','Import',1,'2014-02-04 08:54:06',NULL,'0000-00-00 00:00:00'),
(2441,'en','Province',1,'2021-07-19 10:33:24',NULL,'0000-00-00 00:00:00'),
(2441,'id','Provinsi',1,'2021-07-19 10:33:24',NULL,'0000-00-00 00:00:00'),
(2442,'en','created',1,'2021-07-19 10:39:42',NULL,'0000-00-00 00:00:00'),
(2442,'id','Pembuat',1,'2021-07-19 10:39:42',NULL,'0000-00-00 00:00:00'),
(2443,'en','Excel',1,'2021-07-19 10:50:13',NULL,'0000-00-00 00:00:00'),
(2443,'id','Excel',1,'2021-07-19 10:50:13',NULL,'0000-00-00 00:00:00');
/*Table structure for table `gtfw_lang` */
......@@ -8736,7 +8764,7 @@ CREATE TABLE `gtfw_menu` (
KEY `FK_gtfw_menu_parent` (`menu_parent_id`),
KEY `FK_gtfw_menu_module` (`menu_default_module_id`),
CONSTRAINT `fk_gtfw_menu` FOREIGN KEY (`menu_application_id`) REFERENCES `gtfw_application` (`application_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1;
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=latin1;
/*Data for the table `gtfw_menu` */
......@@ -8778,7 +8806,10 @@ insert into `gtfw_menu`(`menu_id`,`menu_parent_id`,`menu_slug`,`menu_desc`,`men
(34,33,NULL,'Employee Status','Yes',NULL,'employee-status.png','small-employee-status.png',1,1,382,0,NULL,0,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(35,33,NULL,'Employee Type','Yes',NULL,'employee-type.png','small-employee-type.png',2,1,397,0,NULL,0,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(36,0,NULL,'Reports','Yes','large-report.png',NULL,NULL,4,1,NULL,0,NULL,0,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(37,0,NULL,'Sitemap','Yes',NULL,NULL,NULL,1,1,NULL,0,'icon-th-list',1,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00');
(37,0,NULL,'Sitemap','Yes',NULL,NULL,NULL,1,1,NULL,0,'icon-th-list',1,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(38,0,NULL,'menampng modul modul referensi','Yes','','','',3,1,NULL,1,'',0,1,'2021-07-19 10:28:26',NULL,'0000-00-00 00:00:00'),
(39,38,NULL,'menampung data-data provinsi','Yes','','','',0,1,426,1,'',0,1,'2021-07-19 10:29:13',NULL,'0000-00-00 00:00:00'),
(40,0,NULL,'menampilkan member','Yes','','','',0,1,435,1,'',0,1,'2021-07-19 11:08:55',NULL,'0000-00-00 00:00:00');
/*Table structure for table `gtfw_menu_text` */
......@@ -8878,7 +8909,13 @@ insert into `gtfw_menu_text`(`menutext_menu_id`,`menutext_lang_code`,`menutext_
(36,'en','Reports',NULL,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(36,'id','Laporan',NULL,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(37,'en','Sitemap',NULL,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(37,'id','Peta Situs',NULL,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00');
(37,'id','Peta Situs',NULL,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(38,'en','Reference','',1,'2021-07-19 10:28:26',NULL,'0000-00-00 00:00:00'),
(38,'id','Refensi','',1,'2021-07-19 10:28:26',NULL,'0000-00-00 00:00:00'),
(39,'en','Province','',1,'2021-07-19 10:29:13',NULL,'0000-00-00 00:00:00'),
(39,'id','Provinsi','',1,'2021-07-19 10:29:13',NULL,'0000-00-00 00:00:00'),
(40,'en','member','',1,'2021-07-19 11:08:55',NULL,'0000-00-00 00:00:00'),
(40,'id','anggota','',1,'2021-07-19 11:08:55',NULL,'0000-00-00 00:00:00');
/*Table structure for table `gtfw_module` */
......@@ -8905,7 +8942,7 @@ CREATE TABLE `gtfw_module` (
KEY `FK_gtfw_module_menu` (`module_menu_id`),
CONSTRAINT `fk_gtfw_module_0` FOREIGN KEY (`module_application_id`) REFERENCES `gtfw_application` (`application_id`) ON UPDATE CASCADE,
CONSTRAINT `fk_gtfw_module_1` FOREIGN KEY (`module_action_id`) REFERENCES `gtfw_action` (`action_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=426 DEFAULT CHARSET=latin1;
) ENGINE=InnoDB AUTO_INCREMENT=442 DEFAULT CHARSET=latin1;
/*Data for the table `gtfw_module` */
......@@ -9193,7 +9230,23 @@ insert into `gtfw_module`(`module_id`,`module`,`module_sub_module`,`module_acti
(422,'emp.employee.mini','editEmployeeUser','view','html',NULL,'exclusive',5,1,3,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(423,'emp.employee.mini','updateEmployeeUser','do','json',NULL,'exclusive',5,1,3,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(424,'emp.employee.mini','inputEmployeeOfficer','view','html',NULL,'exclusive',5,1,1,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(425,'emp.employee.mini','addEmployeeOfficer','do','json',NULL,'exclusive',5,1,1,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00');
(425,'emp.employee.mini','addEmployeeOfficer','do','json',NULL,'exclusive',5,1,1,NULL,'0000-00-00 00:00:00',NULL,'0000-00-00 00:00:00'),
(426,'tbl.province','tblProvince','view','html','','exclusive',39,1,1,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(427,'tbl.province','detailTblProvince','view','html','','exclusive',39,1,1,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(428,'tbl.province','comboTblProvince','view','html','','exclusive',39,1,1,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(429,'tbl.province','addTblProvince','view','html','','exclusive',39,1,2,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(430,'tbl.province','addTblProvince','do','json','','exclusive',39,1,2,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(431,'tbl.province','updateTblProvince','view','html','','exclusive',39,1,3,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(432,'tbl.province','updateTblProvince','do','json','','exclusive',39,1,3,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(433,'tbl.province','deleteTblProvince','do','json','','exclusive',39,1,4,1,'2021-07-19 10:31:27',NULL,'0000-00-00 00:00:00'),
(434,'tbl.province','excelProvince','view','html',NULL,'exclusive',39,1,6,1,'2021-07-19 11:04:38',NULL,'0000-00-00 00:00:00'),
(435,'tbl.member','tblMember','view','html','','exclusive',40,1,1,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(436,'tbl.member','detailTblMember','view','html','','exclusive',40,1,1,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(437,'tbl.member','addTblMember','view','html','','exclusive',40,1,2,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(438,'tbl.member','addTblMember','do','json','','exclusive',40,1,2,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(439,'tbl.member','updateTblMember','view','html','','exclusive',40,1,3,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(440,'tbl.member','updateTblMember','do','json','','exclusive',40,1,3,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00'),
(441,'tbl.member','deleteTblMember','do','json','','exclusive',40,1,4,1,'2021-07-19 11:09:53',NULL,'0000-00-00 00:00:00');
/*Table structure for table `gtfw_sessions` */
......@@ -54645,6 +54698,54 @@ CREATE TABLE `ref_structural_position_type` (
/*Data for the table `ref_structural_position_type` */
/*Table structure for table `tbl_member` */
DROP TABLE IF EXISTS `tbl_member`;
CREATE TABLE `tbl_member` (
`member_id` int(11) NOT NULL AUTO_INCREMENT,
`member_name` varchar(150) DEFAULT NULL,
`member_birthdate` date DEFAULT NULL,
`member_province_id` int(11) DEFAULT NULL,
`member_gender` enum('L','P') DEFAULT 'P',
`member_latitude` varchar(100) DEFAULT NULL,
`member_longitude` varbinary(100) DEFAULT NULL,
`insert_timestamp` datetime DEFAULT NULL,
`insert_user_id` bigint(20) DEFAULT NULL,
`update_timestamp` datetime DEFAULT NULL,
`update_user_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`member_id`),
KEY `member_province_id_fk` (`member_province_id`),
CONSTRAINT `member_province_id_fk` FOREIGN KEY (`member_province_id`) REFERENCES `tbl_province` (`province_id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_member` */
insert into `tbl_member`(`member_id`,`member_name`,`member_birthdate`,`member_province_id`,`member_gender`,`member_latitude`,`member_longitude`,`insert_timestamp`,`insert_user_id`,`update_timestamp`,`update_user_id`) values
(1,'Tera','1992-07-08',1,'L','-7.805115','110.364193','2021-07-19 11:39:20',1,'2021-07-19 11:51:26',1);
/*Table structure for table `tbl_province` */
DROP TABLE IF EXISTS `tbl_province`;
CREATE TABLE `tbl_province` (
`province_id` int(11) NOT NULL AUTO_INCREMENT,
`province_name` varchar(150) DEFAULT NULL,
`province_status` tinyint(1) DEFAULT '1' COMMENT '1=aktif,0=tidak aktif',
`insert_timestamp` datetime DEFAULT NULL,
`insert_user_id` bigint(20) DEFAULT NULL,
`update_timestamp` datetime DEFAULT NULL,
`update_user_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`province_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*Data for the table `tbl_province` */
insert into `tbl_province`(`province_id`,`province_name`,`province_status`,`insert_timestamp`,`insert_user_id`,`update_timestamp`,`update_user_id`) values
(1,'Daerah Istimewa Yogyakarta',1,'2021-07-19 10:34:39',1,NULL,NULL),
(2,'Aceh',1,'2021-07-19 10:34:51',1,NULL,NULL),
(3,'Nusa Tenggara Barat',1,'2021-07-19 10:35:06',1,NULL,NULL);
/* Procedure structure for procedure `sp_update_employee_number` */
/*!50003 DROP PROCEDURE IF EXISTS `sp_update_employee_number` */;
<?php
/**
* @author GTFW CRUD Generator
*/
class TblMember extends Database
{
public function __construct($connectionNumber = 0)
{
parent::__construct($connectionNumber);
$this->LoadSql('module/tbl.member/business/mysqlt/tblmember.sql.php');
$this->SetDebugOn();
}
public function countTblMember()
{
$query = $this->mSqlQueries['count_tblmember'];
$result = $this->Open($query, array());
return $result[0]['total'];
}
public function getTblMember($filter)
{
if (is_array($filter))
extract($filter);
$str = '';
if (!empty($name)) {
$str .= " AND LOWER(member_name) LIKE('%$name%')";
}
if (!empty($province) && $province != 'all') {
$str .= " AND member_province_id = $province ";
}
if (!empty($gender)) {
$str .= " AND member_gender = '$gender'";
}
$limit = '';
if (!empty($display)) {
$limit = "LIMIT $start, $display";
}
$query = $this->mSqlQueries['get_tblmember'];
$query = str_replace('--search--', $str, $query);
$query = str_replace('--limit--', $limit, $query);
$result = $this->Open(stripslashes($query), array());
// echo '<pre>';
// print_r($this->GetLastError());exit;
return $result;
}
public function getDetailTblMember($id)
{
$result = $this->Open($this->mSqlQueries['get_detail_tblmember'], array($id));
if ($result) {
return $result[0];
}
}
public function listProvince(){
$result = $this->Open($this->mSqlQueries['list_province'],array());
// echo '<pre>';
// print_r($this->GetLastError());exit;
return $result;
}
public function insertTblMember($params)
{
return $this->Execute($this->mSqlQueries['insert_tblmember'], $params);
}
public function updateTblMember($params)
{
return $this->Execute($this->mSqlQueries['update_tblmember'], $params);
}
public function deleteTblMember($id)
{
return $this->Execute($this->mSqlQueries['delete_tblmember'], array($id));
}
public function listTblMember()
{
return $this->Open($this->mSqlQueries['list_tblmember'], array());
}
}
// End of file TblMember.class.php
\ No newline at end of file
<?php
$sql["count_tblmember"] = "
SELECT
FOUND_ROWS() AS total
";
$sql["get_tblmember"] = "
SELECT SQL_CALC_FOUND_ROWS
a.member_id AS `id`,
a.member_name AS `name`,
a.member_birthdate AS `birthdate`,
a.member_province_id AS `province_id`,
a.member_gender AS `gender`,
a.insert_timestamp AS `register_time`,
a.insert_timestamp AS `insert_timestamp`,
a.insert_user_id AS `insert_user_id`,
a.update_timestamp AS `update_timestamp`,
a.update_user_id AS `update_user_id`,
c.province_name as `province`,
IFNULL(CONCAT(b.`user_real_name`,', ',DATE_FORMAT(a.update_timestamp,'%d %b %Y %H:%i')),CONCAT(b.`user_real_name`,', ',DATE_FORMAT(a.insert_timestamp,'%d %b %Y %H:%i'))) AS last_modified
FROM tbl_member a
LEFT JOIN gtfw_user b ON b.`user_id` = a.`insert_user_id`
LEFT JOIN tbl_province c ON c.`province_id` = a.`member_province_id`
WHERE
1 = 1
--search--
--limit--
";
$sql['list_province'] = "
select
province_id as `id`,
province_name as `name`
from tbl_province where province_status = 1
";
$sql["get_detail_tblmember"] = "
SELECT
a.member_id AS `id`,
a.member_name AS `name`,
a.member_birthdate AS `birthdate`,
a.member_province_id AS `province_id`,
a.member_gender AS `gender`,
a.member_latitude as `latitude`,
a.member_longitude as `longitude`,
a.insert_timestamp AS `insert_timestamp`,
a.insert_user_id AS `insert_user_id`,
a.update_timestamp AS `update_timestamp`,
a.update_user_id AS `update_user_id`,
CONCAT(b.`user_real_name`,', ',DATE_FORMAT(a.update_timestamp,'%%d %%b %%Y %%H:%%i')) AS last_update,
CONCAT(b.`user_real_name`,', ',DATE_FORMAT(a.insert_timestamp,'%%d %%b %%Y %%H:%%i')) AS last_insert
FROM tbl_member a
LEFT JOIN gtfw_user b ON b.`user_id` = a.`insert_user_id`
WHERE member_id = %d
";
$sql["insert_tblmember"] = "
INSERT INTO tbl_member
(
member_name,
member_birthdate,
member_province_id,
member_gender,
member_latitude,
member_longitude,
insert_timestamp,
insert_user_id
) VALUES (
%s,
%s,
%s,
%s,
%s,
%s,
NOW(),
%s
)
";
$sql["update_tblmember"] = "
UPDATE tbl_member
SET
member_name = %s,
member_birthdate = %s,
member_province_id = %s,
member_gender = %s,
member_latitude = %s,
member_longitude = %s,
update_timestamp = NOW(),
update_user_id = %s
WHERE member_id = %d
";
$sql["delete_tblmember"] = "
DELETE FROM tbl_member
WHERE member_id = %d
";
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class DoAddTblMember extends JsonResponse
{
function ProcessRequest()
{
$proses = GtfwDispt()->load->process('ProcessTblMember', 'tbl.member');
$result = $proses->input();
if ($result) {
return array('exec' => 'replaceContentWithUrl("subcontent-element","' . GtfwDispt()->GetUrl('tbl.member', 'TblMember', 'view', 'html') . '&display' . '&ascomponent=1")');
} else {
return array('exec' => 'replaceContentWithUrl("subcontent-element","' . GtfwDispt()->GetUrl('tbl.member', 'addTblMember', 'view', 'html') . '&ascomponent=1")');
}
}
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class DoDeleteTblMember extends JsonResponse
{
function ProcessRequest()
{
$proses = GtfwDispt()->load->process('ProcessTblMember', 'tbl.member');
$id = $_GET['id']->Integer()->Raw();
$proses->delete($id);
return array('exec' => 'replaceContentWithUrl("subcontent-element","' . GtfwDispt()->GetUrl('tbl.member', 'TblMember', 'view', 'html') .'&display' . '&ascomponent=1")');
}
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class DoUpdateTblMember extends JsonResponse
{
function ProcessRequest()
{
$proses = GtfwDispt()->load->process('ProcessTblMember', 'tbl.member');
$id = $_POST['id']->Integer()->Raw();
$result = $proses->input();
if ($result) {
return array('exec' => 'replaceContentWithUrl("subcontent-element","' . GtfwDispt()->GetUrl('tbl.member', 'TblMember', 'view', 'html').'&display' . '&ascomponent=1")');
} else {
return array('exec' => 'replaceContentWithUrl("subcontent-element","' . GtfwDispt()->GetUrl('tbl.member', 'updateTblMember', 'view', 'html').'&id='. $id . '&ascomponent=1")');
}
}
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class ProcessTblMember
{
var $Obj;
var $user;
var $cssDone = 'notebox-done';
var $cssFail = 'notebox-warning';
var $cssAlert = 'notebox-alert';
function __construct()
{
$this->ObjTblMember = GtfwDispt()->load->business('TblMember');
$this->user = Security::Authentication()->GetCurrentUser()->GetUserId();
}
function input()
{
$post = $_POST->AsArray();
$Val = GtfwDispt()->load->library('Validation');
$result = $Val->run();
if ($result) {
if (!$post['id']) {
$this->ObjTblMember->StartTrans();
$params = array(
$post['name'],
$post['birthdate'],
$post['province_id'],
$post['gender'],
$post['latitude'],
$post['longitude'],
$this->user
);
$result = $result && $this->ObjTblMember->insertTblMember($params);
$this->ObjTblMember->EndTrans($result);
if ($result) {
$msg = GtfwLangText('msg_add_success');
$css = $this->cssDone;
} else {
$msg = GtfwLangText('msg_add_fail');
$css = $this->cssFail;
}
} else {
$this->ObjTblMember->StartTrans();
$params = array(
$post['name'],
$post['birthdate'],
$post['province_id'],
$post['gender'],
$post['latitude'],
$post['longitude'],
$this->user,
$post['id']
);
$result = $result && $this->ObjTblMember->updateTblMember($params);
$this->ObjTblMember->EndTrans($result);
if ($result) {
$msg = GtfwLangText('msg_update_success');
$css = $this->cssDone;
} else {
$msg = GtfwLangText('msg_update_fail');
$css = $this->cssFail;
}
}
} else {
$msg = $Val->error_string('', '<br />');
$css = $this->cssFail;
}
if ($result) {
Messenger::Instance()->Send('tbl.member', 'TblMember', 'view', 'html', array(NULL, $msg, $css), Messenger::NextRequest);
//return Dispatcher::Instance()->GetUrl('tbl.member', 'tblmember', 'view', 'html');
} else {
Messenger::Instance()->Send('tbl.member', 'inputTblMember', 'view', 'html', array($post, $msg, $css), Messenger::NextRequest);
//return Dispatcher::Instance()->GetUrl('tbl.member', (empty($post['id'])?'add':'update').'TblMember', 'view', 'html');
}
return $result;
}
function delete($id)
{
$result = $this->ObjTblMember->deleteTblMember($id);
if ($result) {
$msg = GtfwLangText('msg_delete_success');
$css = $this->cssDone;
} else {
$msg = GtfwLangText('msg_delete_fail');
$css = $this->cssFail;
}
Messenger::Instance()->Send('tbl.member', 'TblMember', 'view', 'html', array(NULL, $msg, $css), Messenger::NextRequest);
return $result;
}
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
GtfwDispt()->load->response('ViewInputTblMember');
class ViewAddTblMember extends ViewInputTblMember
{
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class ViewDetailTblMember extends HtmlResponse
{
function TemplateModule()
{
$this->SetTemplateBasedir(Configuration::Instance()->GetValue('application','docroot').'module/'.GtfwDispt()->mModule.'/template');
$this->SetTemplateFile('view_detail_tblmember.html');
}
function ProcessRequest()
{
$ObjTblMember = GtfwDispt()->load->business('TblMember', 'tbl.member');
$id = $_GET['id']->Integer()->Raw();
$detail = $ObjTblMember->getDetailTblMember($id);
$nav[0]['url'] = GtfwDispt()->GetUrl('tbl.member', 'TblMember', 'view', 'html').'&display';
$nav[0]['menu'] = 'TblMember';
$title = GtfwLangText('detail');
Messenger::Instance()->SendToComponent('comp.breadcrump', 'breadcrump', 'view', 'html', 'breadcrump', array($title, $nav, 'breadcrump', '', ''), Messenger::CurrentRequest);