Commit 250c5c11 authored by Prasetyo Edi Pamungkas's avatar Prasetyo Edi Pamungkas
Browse files

up prasetyo latihan two

parent d204b9c9
<?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'] = 'latihan_tugas';
$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/latihan_tugas/base/
\ No newline at end of file
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()
{
$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);
return compact('detail');
}
function ParseTemplate($rdata = NULL)
{
extract($rdata);
if (!empty($detail)) {
$this->mrTemplate->addVars('content', $detail);
}
}
}
?>
\ No newline at end of file
<?php
/**
* @author Prima Noor
*/
class ViewInputTblMember extends HtmlResponse
{
function TemplateModule()
{
$this->SetTemplateBasedir(Configuration::Instance()->GetValue('application','docroot').'module/'.GtfwDispt()->mModule.'/template');
$this->SetTemplateFile('view_input_tblmember.html');
}
function ProcessRequest()
{
$ObjTblMember = GtfwDispt()->load->business('TblMember', 'tbl.member');
$id = $_GET['id']->Integer()->Raw();
$elmId = $_GET['elmId']->SqlString()->Raw();
$msg = Messenger::Instance()->Receive(__FILE__);
$post = isset($msg[0][0])?$msg[0][0]:NULL;
$message['content'] = isset($msg[0][1])?$msg[0][1]:NULL;
$message['style'] = isset($msg[0][2])?$msg[0][2]:NULL;
if (!empty($post)) {
$input = $post;
} elseif(!empty($id)) {