Commit 6d4939ba authored by Prasetyo Edi Pamungkas's avatar Prasetyo Edi Pamungkas
Browse files

Up Prasetyo latihan one

parent 24f1e323
<?php
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
//
$application['application_id'] = 1;
// do not edit this config
$application['gtfw_base'] = GTFW_BASE_DIR;
$application['docroot'] = GTFW_APP_DIR;
$application['basedir'] = str_replace(basename($_SERVER['SCRIPT_NAME']), "", $_SERVER['SCRIPT_NAME']); // with trailling slash
$application['baseaddress'] = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://" . $_SERVER['HTTP_HOST']; // without trailling slash
$application['domain'] = NULL; // name of domain
//============database============================
// connection number 0
$application['db_conn'][0]['db_driv'] = 'pdo';
$application['db_conn'][0]['db_type'] = 'mysqlt';
$application['db_conn'][0]['db_host'] = 'localhost';
$application['db_conn'][0]['db_user'] = 'root';
$application['db_conn'][0]['db_pass'] = '';
$application['db_conn'][0]['db_name'] = 'pelatihan_gtfw_session1';
$application['db_conn'][0]['db_result_cache_lifetime'] = '';
$application['db_conn'][0]['db_result_cache_path'] = '';
$application['db_conn'][0]['db_debug_enabled'] = '';
$application['db_conn'][0]['db_port'] = '3306';
/* sample connection number 1
$application['db_conn'][1]['db_driv'] = 'adodb';
$application['db_conn'][1]['db_type'] = 'mysqlt';
$application['db_conn'][1]['db_host'] = 'localhost';
$application['db_conn'][1]['db_user'] = 'user';
$application['db_conn'][1]['db_pass'] = 'pass';
$application['db_conn'][1]['db_name'] = 'databasename';
$application['db_conn'][1]['db_result_cache_lifetime'] = '';
$application['db_conn'][1]['db_result_cache_path'] = '';
$application['db_conn'][1]['db_debug_enabled'] = '';
$application['db_conn'][1]['db_port'] = '3306';
*/
/*
=================================================
sample Connection for Oracle database
=================================================
$application['db_conn'][0]['db_driv'] = 'adodb';
$application['db_conn'][0]['db_type'] = 'oci8';
$application['db_conn'][0]['db_host'] = 'localhost';
$application['db_conn'][0]['db_user'] = 'GTFW';
$application['db_conn'][0]['db_pass'] = 'GTFWENTERPRISE';
$application['db_conn'][0]['db_name'] = 'ORCL';
*/
//============session============================
$application['use_session'] = TRUE;
$application['session_name'] = 'GTFW35SessID';
$application['session_save_path'] = NULL; //TODO: should not be here!!!, and pelase, support NULL value to fallback to PHP INI's session save path
$application['session_expire'] = 30; // in minutes
$application['session_cookie_params']['lifetime'] = 60 * $application['session_expire']; // in seconds
$application['session_cookie_params']['path'] = $application['basedir'];
$application['session_cookie_params']['domain'] = $application['domain'];
$application['session_cookie_params']['secure'] = FALSE; // needs secure connection?
//============default page============================
$application['default_page']['mod'] = 'core.home';
$application['default_page']['sub'] = 'landingPage';
$application['default_page']['act'] = 'view';
$application['default_page']['typ'] = 'html';
//============login page============================
$application['login_page']['mod'] = 'core.login';
$application['login_page']['sub'] = 'login';
$application['login_page']['act'] = 'view';
$application['login_page']['typ'] = 'html';
//============security===========================
$application['enable_security'] = true;
$application['default_user'] = 'nobody';
$application['enable_url_obfuscator'] = FALSE;
$application['url_obfuscator_exception'] = array('soap'); // list of exeption request/response type
$application['url_type'] = 'Long'; // type: Long or Short
$application['login_method'] = 'default';
//============development============================
$application['debug_mode'] = TRUE;
//=========== Single Sign On ========================
$application['system_id'] = 'com.gamatechno.gtfw';
$application['sso_group'] = 'com_gamatechno_academica'; //FIXME: what if this system is associated with more than one sso group
//=========== Single Sign On Server ========================
$application['sso_ldap_connection'] = 3; // connection number available for ldap access, see db_conn above
//============== syslog =============================
$application['syslog_enabled'] = FALSE;
$application['syslog_category'] = array(); // what category permitted to be printed out, array() equals all category
$application['syslog_io_engine'] = 'std'; //tcp, file, std
$application['syslog_log_path'] = '/tmp';
$application['syslog_tcp_host'] = 'localhost';
$application['syslog_tcp_port'] = 9777;
//================ soapgateway ========================
$application['wsdl_use_cache'] = false; // use cached wsdl if available
$application['wsdl_cache_path'] = '/path/to/soap/'; // use cached wsdl if available
$application['wsdl_cache_lifetime'] = 60 * 60 * 24 /* one day! */; // invalidate wsdl cache every x seconds
//================ additional config =====================
$application['company_name'] = "Gamatechno";
$application['application_name'] = "gtEnterprise App Base";
$application['company_address'] = "Jl. Kaliurang Km.5, no.53, Depok, Sleman";
//================Gaji=====================
//================Upload Dir ==============
$application['upload_dir_path'] = "upload_file/";
$application['icon_save_path'] = "files/icons/";
$application['icon_condition_save_path'] = "assets/images/icons/";
$application['employee_save_path'] = "files/employee/";
$application['transfer_save_path'] = "files/transfer/history/";
$application['identity_history_save_path'] = "files/history/identity/";
$application['education_history_save_path'] = "files/history/history/";
$application['medical_history_save_path'] = "files/history/medical/";
$application['transaction_history_save_path'] = "files/history/transaction/";
$application['master_save_path'] = "files/master/";
$application['account_logo_save_path'] = "files/crm/";
$application['contact_logo_save_path'] = "files/crm/contact/";
$application['vendor_save_path'] = "files/purchasing/master/";
$application['company_save_path'] = "files/reference/company/";
$application['fxa_master_save_path'] = "files/fxa/";
$application['ga_master_save_path'] = "files/ga/";
$application['crm_save_path'] = "files/crm/";
$application['icon_path'] = "assets/images/icons/";
$application['family_save_path'] = "files/family/";
$application['cms_save_path'] = "files/cms/";
//================Language=====================
$application['language'] = 'id';
$application['send_email'] = false;
$application['asset_usage_send_email'] = true;
$application['asset_usage_send_notification'] = false;
$application['smtp_host'] = 'mail.domain.com';
$application['smtp_port'] = '25';
$application['smtp_auth'] = true;
$application['smtp_username'] = 'email_tester@domain.com';
$application['smtp_password'] = 'password';
//=================date ref==================
$application['date_time_zone'] = 'Asia/Jakarta'; // see http://php.net/manual/en/timezones.php
date_default_timezone_set($application['date_time_zone']);
$application['autoload_notif'] = false;
?>
C:/xampp/htdocs/gtfw-master/base/
\ No newline at end of file
......@@ -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_session1` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `pelatihan_gtfw`;
USE `pelatihan_gtfw_session1`;
/*Table structure for table `comp_email_history` */
This diff is collapsed.
<?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($filter)
{
if (is_array($filter))
extract($filter);
$str = '';
if (!empty($name)) {
$str .= " AND LOWER(member_name) LIKE('%$name%')";
}
if (!empty($job)) {
$str .= " AND LOWER(member_job) LIKE('%$job%')";
}
if (!empty($address)) {
$str .= " AND LOWER(member_address) LIKE('%$address%')";
}
$query = $this->mSqlQueries['count_tblmember'];
$query = str_replace('--search--', $str, $query);
$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($job)) {
$str .= " AND LOWER(member_job) LIKE('%$job%')";
}
if (!empty($address)) {
$str .= " AND LOWER(member_address) LIKE('%$address%')";
}
$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());
return $result;
}
public function getDetailTblMember($id)
{
$result = $this->Open($this->mSqlQueries['get_detail_tblmember'], array($id));
if ($result) {
return $result[0];
}
}
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
COUNT(member_id) AS total
FROM tbl_member
WHERE
1 = 1
--search--
";
$sql["get_tblmember"] = "
SELECT
a.member_id AS `id`,
a.member_name AS `name`,
a.member_job AS `job`,
a.member_address AS `address`,
a.insert_timestamp AS `insert_timestamp`,
a.insert_user_id AS `insert_user_id`,
a.update_timestamp AS `update_timestamp`,
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`
WHERE
1 = 1
--search--
--limit--
";
$sql["get_detail_tblmember"] = "
SELECT
a.member_id AS `id`,
a.member_name AS `name`,
a.member_job AS `job`,
a.member_address AS `address`,
a.insert_timestamp AS `insert_timestamp`,
a.insert_user_id AS `insert_user_id`,
a.update_timestamp AS `update_timestamp`,
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_job,
member_address,
insert_timestamp,
insert_user_id
) VALUES (
%s,
%s,
%s,
NOW(),
%s
)
";
$sql["update_tblmember"] = "
UPDATE tbl_member
SET
member_name = %s,
member_job = %s,
member_address = %s,
update_timestamp = NOW()
WHERE member_id = %d
";
$sql["delete_tblmember"] = "
DELETE FROM tbl_member
WHERE member_id = %d
";
$sql["list_tblmember"] = "
SELECT
member_id AS `id`,
member_name AS `name`
FROM
tbl_member
ORDER BY member_name
";
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class DoAddTblMember extends JsonResponse
{
function ProcessRequest()
{
$proses = GtfwDispt()->load->process('ProcessTblMember', 'tbl.member');
$post = $_POST->AsArray();
$result = $proses->input();
$elmId = $_GET['elmId']->SqlString()->Raw();
if ($result) {
if (!empty($elmId)) {
$url = GtfwDispt()->GetUrl('tbl.member', 'comboTblMember', 'view', 'html').'&ascomponent=1';
return array('exec' => "replaceContentWithUrl('div_$elmId', '".$url."');closeGtPopup(popup$elmId);");
} else {
$url = GtfwDispt()->GetUrl('tbl.member', 'TblMember', 'view', 'html').'&display&ascomponent=1';
return array('exec' => "replaceContentWithUrl('subcontent-element', '".$url."');closeGtPopup(popupTblMember);");
}
} else {
if (!empty($elmId)) {
return array('exec' => "replaceContentWithUrl('popup-$elmId', '" . GtfwDispt()->GetUrl('tbl.member', (empty($post['dataId']) ? 'addTblMember' : 'updateTblMember'), 'view', 'html') . (!empty($elmId) ? ('&elmId=' . $elmId) : '') . "&ascomponent=1')");
} else {
return array('exec' => "replaceContentWithUrl('popup-subcontent', '" . GtfwDispt()->GetUrl('tbl.member', (empty($post['dataId']) ? 'addTblMember' : 'updateTblMember'), 'view', 'html') . (!empty($elmId) ? ('&elmId=' . $elmId) : '') . "&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"); ;closeGtPopup(popupTblMember);');
} else {
return array('exec' => 'replaceContentWithUrl("popup-subcontent","' . 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');
$Val->set_rules('name', GtfwLangText('name'), 'required');
$Val->set_rules('job', GtfwLangText('job'), 'required');
$Val->set_rules('address', GtfwLangText('address'), 'required');
$result = $Val->run();
if ($result) {
if (!$post['id']) {
$this->ObjTblMember->StartTrans();
$params = array(
$post['name'],
$post['job'],
$post['address'],
$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['job'],
$post['address'],
$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 ViewComboTblMember extends HtmlResponse
{
function TemplateModule()
{
$this->SetTemplateBasedir(Configuration::Instance()->GetValue('application', 'docroot') . 'module/tbl.member/template');
$this->SetTemplateFile('view_combo_tblmember.html');
}
function ProcessRequest()
{
$ObjTblMember = GtfwDispt()->load->business('TblMember', 'tbl.member');
$msg = Messenger::Instance()->Receive(__file__, $this->mComponentName);
Messenger::Instance()->Receive(__file__);
$comboData = !empty($msg) ? $msg[count($msg)-1] : null;
// apakah perlu UntilFetched
Messenger::Instance()->Send('tbl.member', 'comboTblMember', 'view', 'html', $comboData, Messenger::UntilFetched);
$allowAdd = Security::Authorization()->IsAllowedToAccess('tbl.member', 'addTblMember', 'view', 'html');
$list = $ObjTblMember->listTblMember();
return compact('list', 'comboData', 'allowAdd');
}
function ParseTemplate($rdata = null)
{
extract($rdata);
if (!empty($comboData)) {
$comboData['name'] = empty($comboData['name']) ? $comboData['elmId'] : $comboData['name'];
$this->mrTemplate->addVars('combobox', $comboData);
}
if (!empty($comboData['elmId'])) {
$this->mrTemplate->addVar('combobox', 'ELMID', $comboData['elmId']);
if (!empty($comboData['showAdd']) and $allowAdd) {
$this->mrTemplate->setAttribute('button_add', 'visibility', 'show');
$this->mrTemplate->addVar('button_add', 'ELMID', $comboData['elmId']);
$this->mrTemplate->addVar('button_add', 'URL', GtfwDispt()->GetUrl('tbl.member', 'addTblMember', 'view', 'html').'&elmId='.$comboData['elmId']);
}
}
if (!empty($comboData['first'])) {
if ($comboData['first'] === 'all') {
$this->mrTemplate->addVar('combolist', 'ID', 'all');
$this->mrTemplate->addVar('combolist', 'NAME', "-- " . ucwords(GtfwLangText('all')) . " --");
$this->mrTemplate->parseTemplate('combolist', 'a');