Compare commits
2
Commits
bc95edbc0f
...
v1.0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17188f6134 | ||
|
|
8a758e5875 |
Vendored
+1
-1
@@ -1882,7 +1882,7 @@ progress {
|
||||
.table > :not(caption) > * > * {
|
||||
padding: 0.5rem 0.5rem;
|
||||
color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color)));
|
||||
background-color: var(--bs-table-bg);
|
||||
/*background-color: var(--bs-table-bg);*/
|
||||
border-bottom-width: var(--bs-border-width);
|
||||
box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg)));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Desc. : CSS Default Configuration
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 20th, 2007.
|
||||
Last Modified : February 7th, 2026.
|
||||
Last Modified : September 27th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -343,6 +343,14 @@ ul.dtr-details li.hidden { visibility: hidden !important; display: none !importa
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bootstrap-autocomplete.dropdown-menu .dropdown-item.active .text-primary {
|
||||
color: #93f6c5 !important;
|
||||
}
|
||||
|
||||
.bootstrap-autocomplete.dropdown-menu .dropdown-item.active .text-danger {
|
||||
color: #f4c8d2 !important;
|
||||
}
|
||||
|
||||
/******************************** text field ********************************/
|
||||
|
||||
input.double, input.integer, input.number {
|
||||
|
||||
+5
-7
@@ -39,7 +39,7 @@ var AjaxResolver = (function (_super) {
|
||||
url: '',
|
||||
method: 'post',
|
||||
queryKey: 'Auto_Query',
|
||||
extraData: {},
|
||||
param: [],
|
||||
timeout: 0,
|
||||
requestThrottling: 500
|
||||
};
|
||||
@@ -51,7 +51,7 @@ var AjaxResolver = (function (_super) {
|
||||
}
|
||||
var data = {};
|
||||
data[this._settings.queryKey] = q;
|
||||
$.extend(data, this._settings.extraData);
|
||||
if (this._settings.param.length > 0) $.extend(data, FoniaJS.RequestParam(this._settings.param));
|
||||
if (this.requestTID) {
|
||||
window.clearTimeout(this.requestTID);
|
||||
}
|
||||
@@ -97,13 +97,12 @@ var DropdownV5 = (function () {
|
||||
DropdownV5.prototype.init = function () {
|
||||
var _this = this;
|
||||
var pos = this.getElPos();
|
||||
var fontsize = _this._$el.css('font-size');
|
||||
this._dd = $('<div />');
|
||||
this._dd.addClass('bootstrap-autocomplete dropdown-menu');
|
||||
this._dd.insertAfter(this._$el);
|
||||
this._dd.css({ top: pos.top + this._$el.outerHeight(), left: pos.left, width: this._$el.outerWidth() });
|
||||
this._dd.css({ top: pos.top + this._$el.outerHeight(), left: pos.left, width: this._$el.outerWidth(), 'font-size': fontsize });
|
||||
this._dd.on('click', '.dropdown-item', function (evt) {
|
||||
//console.log('clicked', evt.currentTarget);
|
||||
//console.log($(evt.currentTarget));
|
||||
var item = $(evt.currentTarget).data('item');
|
||||
_this.itemSelectedLaunchEvent(item);
|
||||
evt.preventDefault();
|
||||
@@ -239,8 +238,7 @@ var DropdownV5 = (function () {
|
||||
itemText = _this.showMatchedText(itemFormatted.text, _this.searchText);
|
||||
if (itemFormatted.html !== undefined) {
|
||||
itemHtml = itemFormatted.html;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
itemHtml = itemText;
|
||||
}
|
||||
var disabledItem = itemFormatted.disabled;
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /assets/js/download.js
|
||||
Desc. : Fungsi-fungsi download data & laporan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 1st, 2011.
|
||||
Last Modified : October 2nd, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var Download = function(options) {
|
||||
var _options = {
|
||||
'url': '',
|
||||
'filename': 'file.bin',
|
||||
'title': '',
|
||||
'text': 'share dari aplikasi'
|
||||
};
|
||||
var _params = [];
|
||||
|
||||
this.construct = function(options){
|
||||
if (typeof options == 'object') {
|
||||
$.extend(_options, options);
|
||||
} else _options.url = options;
|
||||
};
|
||||
this.set_url = function (url){
|
||||
_options.url = url;
|
||||
};
|
||||
this.add_param = function(par_id, par_val) {
|
||||
var _getvalue = (par_val) ? par_id + '=' + encodeURIComponent(par_val) : par_id;
|
||||
_params.push(_getvalue);
|
||||
};
|
||||
this._exec = async function(is_share) {
|
||||
if (!_options.url) {
|
||||
console.warn('cek url !');
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const blob = await $.ajax({
|
||||
type: 'POST',
|
||||
url: _options.url,
|
||||
data: FoniaJS.RequestParam(_params),
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
success: async function (data, status, xhr) {
|
||||
const disposition = xhr.getResponseHeader('Content-Disposition');
|
||||
if (disposition && disposition.indexOf('attachment') !== -1) {
|
||||
const filenameRegex = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/;
|
||||
const matches = filenameRegex.exec(disposition);
|
||||
if (matches != null && matches[1]) {
|
||||
_options.filename = matches[1].replace(/['"]/g, '');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
const file = new File([blob], _options.filename, { type: blob.type });
|
||||
|
||||
if (is_share === true && navigator.canShare && navigator.canShare({ files: [file] })) {
|
||||
await navigator.share({
|
||||
files: [file],
|
||||
title: _options.title ?? _options.filename,
|
||||
text: _options.text
|
||||
});
|
||||
} else {
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = _options.filename;
|
||||
link.click();
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Download / sharing gagal :', error);
|
||||
};
|
||||
return this;
|
||||
};
|
||||
this.share = async function() {
|
||||
await this._exec(true);
|
||||
};
|
||||
this.download = async function() {
|
||||
await this._exec(false);
|
||||
};
|
||||
this.construct(options);
|
||||
};
|
||||
@@ -1,63 +0,0 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /assets/js/export.js
|
||||
Desc. : Fungsi-fungsi export data & laporan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 1st, 2011.
|
||||
Last Modified : January 19th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cEXPORT = function(url, options){
|
||||
var _options = {
|
||||
'url': '',
|
||||
'filename': ''
|
||||
};
|
||||
var _params = [];
|
||||
|
||||
this.construct = function(url, options){
|
||||
if (typeof url == 'object') {
|
||||
$.extend(_options, url);
|
||||
} else {
|
||||
$.extend(_options, options);
|
||||
_options.url = url;
|
||||
}
|
||||
};
|
||||
this.set_url = function (url){
|
||||
_options.url = url;
|
||||
};
|
||||
this.add_param = function (par_id, par_val){
|
||||
var _getvalue = (par_val) ? par_id + "=" + escape(par_val) : par_id;
|
||||
_params.push(_getvalue);
|
||||
},
|
||||
this.download = async function(){
|
||||
if (!_options.url) {
|
||||
console.warn('cek url !');
|
||||
return false;
|
||||
}
|
||||
var _pro = (window.location.protocol=='https:') ? 'https://' : 'http://';
|
||||
var _src = _pro+FoniaJS.WEB_HOST + _options.url + '?' + (FoniaJS.RequestParam(_params)).join('&');
|
||||
|
||||
try {
|
||||
const response = await fetch(_src)
|
||||
.then(response => {
|
||||
const cDispo = response.headers.get('Content-Disposition');
|
||||
if (cDispo && cDispo.indexOf('filename=') !== -1) {
|
||||
_options.filename = cDispo.split('filename=')[1].split(';')[0].replace(/"/g, '');
|
||||
}
|
||||
return response;
|
||||
})
|
||||
const blob = await response.blob();
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = _options.filename;
|
||||
link.click();
|
||||
} catch (error) {
|
||||
console.error('Download gagal:', error);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
this.construct(url, options);
|
||||
};
|
||||
+86
-60
@@ -4,7 +4,7 @@
|
||||
Desc. : JS - Fonia Custom Class v3
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 19th, 2009.
|
||||
Last Modified : September 4th, 2026.
|
||||
Last Modified : September 28th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -157,7 +157,7 @@ var FoniaJS = {
|
||||
var _buover = (buserover == null) ? false : buserover;
|
||||
var _tsid = parseInt(Math.random() * 99999999);
|
||||
var _ceksuper = null;
|
||||
var _isi = new String('<div class="row mb-1" id="Auth_SP1"><div class="col-sm-6 col-lg-5">Username</div><div class="col-sm-6 col-lg-7"><input type="text" class="form-control" id="UID" name="UID" value="'+((_bsuper===false)?this.User.ID:'')+'" required="true"></div></div><div class="row mb-1" id="Auth_SP2"><div class="col-sm-6 col-lg-5">Password</div><div class="col-sm-6 col-lg-7"><input type="password" class="form-control" id="PWD" name="PWD" value="" required="true"></div></div><div class="row mb-1 d-none" id="Auth_SP3"><div class="col-12 text-center"><p>'+this.locale("Fonia.auth_wait_msg")+'</p></div></div><hr class="my-2"><div class="row mt-1"><div class="col-4"><button type="button" class="btn btn-outline-primary shadow-none" id="butSReq">Request</button></div><div class="col-8 text-end"><button type="button" class="btn btn-danger me-2" id="butSBatal" data-bs-dismiss="modal">Batal</button><button type="button" class="btn btn-success" id="butSOK">OK</button></div></div>');
|
||||
var _isi = new String('<div class="row mb-1" id="Auth_SP1"><div class="col-sm-6 col-lg-5 col-form-label">Username</div><div class="col-sm-6 col-lg-7"><input type="text" class="form-control" id="UID" name="UID" value="'+((_bsuper===false)?this.User.ID:'')+'" required="true"></div></div><div class="row mb-1" id="Auth_SP2"><div class="col-sm-6 col-lg-5 col-form-label">Password</div><div class="col-sm-6 col-lg-7"><input type="password" class="form-control" id="PWD" name="PWD" value="" required="true"></div></div><div class="row mb-1 d-none" id="Auth_SP3"><div class="col-12 text-center"><p>'+this.locale("Fonia.auth_wait_msg")+'</p></div></div><hr class="my-2"><div class="row mt-1"><div class="col-4"><button type="button" class="btn btn-outline-primary shadow-none" id="butSReq">Request</button></div><div class="col-8 text-end"><button type="button" class="btn btn-danger me-2" id="butSBatal" data-bs-dismiss="modal">Batal</button><button type="button" class="btn btn-success" id="butSOK">OK</button></div></div>');
|
||||
this.winSAuth = this.showWindow('SAuth', ((this.AUTH_LEVEL < 9 && _bsuper == true) ? this.locale("Fonia.auth_super") : this.locale("Fonia.auth_user")), _isi, 200, '', () => {
|
||||
$('#butSOK').click(() => {
|
||||
$('#butSOK').prop('disabled', true);
|
||||
@@ -242,10 +242,10 @@ var FoniaJS = {
|
||||
if (!menu) return '';
|
||||
var smenu = '';
|
||||
if (typeof menu === 'object'){
|
||||
var ma = ' me-sm-2'; smenu = '<div class="col-12 col-sm-6 my-0 mx-sm-0 text-center text-sm-start">';
|
||||
var ma = ' me-sm-2'; smenu = '<div class="col-12 col-md-auto px-0 text-center text-sm-start">';
|
||||
$(menu).each((i, atom) => {
|
||||
if (Object.keys(atom).length === 0) {
|
||||
smenu += '</div><div class="col-12 col-sm-6 my-0 mx-sm-0 text-center text-sm-end">';
|
||||
smenu += '</div><div class="col-12 col-sm-auto px-0 text-center text-sm-end">';
|
||||
ma = ' ms-sm-2';
|
||||
} else {
|
||||
if (atom.i == 'butTutup') { atom.v='Tutup', atom.c='danger', atom.d='' };
|
||||
@@ -286,18 +286,29 @@ var FoniaJS = {
|
||||
FormDecorated: function() {
|
||||
$('input.form-control[class*=integer], input.form-control[class*=angka]').each((i, el) => {
|
||||
const elm = $(el);
|
||||
elm.on('keypress keyup blur paste', (e) => {
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('keypress keyup paste', (e) => {
|
||||
elm.val(elm.val().replace(/[^\d].+/, ""));
|
||||
if ((e.which < 48 || e.which > 57)) e.preventDefault();
|
||||
});
|
||||
});
|
||||
$('input.form-control[class*=double]').each((i, el) => {
|
||||
const elm = $(el);
|
||||
elm.on('keypress keyup blur paste', (e) => {
|
||||
elm.val(elm.val().replace(/[^0-9\.]/g,''));
|
||||
if (e.type === 'blur') elm.val( FoniaJS.FloatToStr(elm.val(), 2) );
|
||||
if ((e.which != 46 || elm.val().indexOf('.') != -1) && (e.which < 48 || e.which > 57)) e.preventDefault();
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('keypress keyup input', (e) => {
|
||||
if (e.type === 'keypress') {
|
||||
if ((e.which != 45 || elm.val().indexOf('-') != -1) && (e.which != 46 || elm.val().indexOf('.') != -1) && (e.which < 48 || e.which > 57)) e.preventDefault();
|
||||
} else {
|
||||
var _val = elm.val().replace(/[^0-9.-]/g, '');
|
||||
if (_val.indexOf('-') > 0) _val = _val.charAt(0) + _val.slice(1).replace(/-/g, '');
|
||||
var _parts = _val.split('.');
|
||||
if (_parts.length > 2) _val = _parts[0] + '.' + _parts.slice(1).join('');
|
||||
elm.val(_val);
|
||||
}
|
||||
});
|
||||
elm.on('blur', () => elm.val( FoniaJS.FloatToStr(elm.val(), 2) ));
|
||||
elm.on('focus', (e) => {
|
||||
elm.val( FoniaJS.StrToFloat(elm.val()) );
|
||||
elm.select();
|
||||
@@ -306,9 +317,18 @@ var FoniaJS = {
|
||||
});
|
||||
$('input.form-control[type=number]').each((i, el) => {
|
||||
const elm = $(el);
|
||||
elm.on('keypress keyup blur paste', (e) => {
|
||||
elm.val(elm.val().replace(/[^0-9]/g,''));
|
||||
if ((e.which != 46 || elm.val().indexOf('.') != -1) && (e.which < 48 || e.which > 57)) e.preventDefault();
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('keypress keyup input', (e) => {
|
||||
if (e.type === 'keypress') {
|
||||
if ((e.which != 45 || elm.val().indexOf('-') != -1) && (e.which != 46 || elm.val().indexOf('.') != -1) && (e.which < 48 || e.which > 57)) e.preventDefault();
|
||||
} else {
|
||||
var _val = elm.val().replace(/[^0-9.-]/g, '');
|
||||
if (_val.indexOf('-') > 0) _val = _val.charAt(0) + _val.slice(1).replace(/-/g, '');
|
||||
var _parts = _val.split('.');
|
||||
if (_parts.length > 2) _val = _parts[0] + '.' + _parts.slice(1).join('');
|
||||
elm.val(_val);
|
||||
}
|
||||
});
|
||||
});
|
||||
$('input.form-control, textarea.form-control, select.form-select').each((i, el) => {
|
||||
@@ -316,6 +336,8 @@ var FoniaJS = {
|
||||
const okyup = elm.attr('okyup') ?? '';
|
||||
const oblur = elm.attr('oblur') ?? '';
|
||||
const ochan = elm.attr('ochan') ?? '';
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('keyup blur change', (e) => {
|
||||
if (e.type === 'keyup' && okyup) {
|
||||
var fnc = okyup.split('.');
|
||||
@@ -340,6 +362,8 @@ var FoniaJS = {
|
||||
});
|
||||
$('input.form-check-input[type=radio]').each((i, el) => {
|
||||
const elm = $(el);
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('click', () => {
|
||||
const oclic = elm.attr('ochan') ?? '';
|
||||
const elp = $('#'+elm.attr('name'));
|
||||
@@ -354,6 +378,8 @@ var FoniaJS = {
|
||||
});
|
||||
$('input.form-check-input[type=checkbox]').each((i, el) => {
|
||||
const elm = $(el);
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
elm.on('change', () => {
|
||||
const odata = JSON.parse(elm.attr('odata') ?? '[]');
|
||||
const ochan = elm.attr('ochan') ?? '';
|
||||
@@ -393,49 +419,47 @@ var FoniaJS = {
|
||||
}
|
||||
if ('function' == typeof autosize) autosize($('textarea'));
|
||||
},
|
||||
|
||||
RequestParam: function(aparam) {
|
||||
var tmp_hasil = [];
|
||||
var tmp_array = aparam;
|
||||
var tmp_cblist = {};
|
||||
var _cblist = {};
|
||||
var _ohasil = {};
|
||||
$('tbody input[id*="cbox"][type="checkbox"]:checked').map((i, b) => {
|
||||
const arr = b.id.split('_');
|
||||
if (!tmp_cblist[arr[0]]) tmp_cblist[arr[0]] = [];
|
||||
tmp_cblist[arr[0]].push(arr[2]);
|
||||
// for compatible only
|
||||
tmp_array.push(b.id + '=' + b.value);
|
||||
if (!_cblist[arr[0]]) _cblist[arr[0]] = [];
|
||||
_cblist[arr[0]].push(arr[2]);
|
||||
});
|
||||
$.each(tmp_cblist, (i, b) => {
|
||||
tmp_array.push('List_CB_' + i + '=' + b.join());
|
||||
$.each(_cblist, (i, b) => {
|
||||
_ohasil['List_CB_' + i] = b.join();
|
||||
});
|
||||
tmp_array.map(nilai => {
|
||||
if (typeof nilai === "string") {
|
||||
var tmp_value = "";
|
||||
if (nilai.indexOf("=") == -1) {
|
||||
if ($('#'+nilai).length) {
|
||||
tmp_value = $('#'+nilai).val();
|
||||
if (typeof tmp_value === 'undefined') {
|
||||
tmp_value = ($('#'+nilai).is('.integer, .number, .double')) ? '0' : '';
|
||||
if (typeof aparam === 'object') {
|
||||
aparam.map(_par => {
|
||||
if (typeof _par !== "string") this.return;
|
||||
var _key = _par, _val = "";
|
||||
const _ind = _par.indexOf('=');
|
||||
if (_ind !== -1) {
|
||||
_key = _par.slice(0, _ind);
|
||||
_val = _par.slice(_ind + 1);
|
||||
} else {
|
||||
tmp_value = ($('#'+nilai).is('.integer, .number, .double')) ? this.StrToFloat(tmp_value) : encodeURIComponent(tmp_value);
|
||||
}
|
||||
}
|
||||
tmp_value = nilai + "=" + tmp_value;
|
||||
if ($('#'+_par).length) {
|
||||
_val = $('#'+_par).val();
|
||||
if (typeof _val === 'undefined') {
|
||||
_val = ($('#'+_par).is('.integer, .number, .double')) ? 0 : '';
|
||||
} else {
|
||||
tmp_value = nilai;
|
||||
_val = ($('#'+_par).is('.integer, .number, .double')) ? this.StrToFloat(_val) : encodeURIComponent(_val);
|
||||
}
|
||||
tmp_hasil.push(tmp_value);
|
||||
}
|
||||
}
|
||||
_ohasil[_key] = _val;
|
||||
});
|
||||
tmp_hasil.push('SID=' + parseInt(Math.random() * 99999999));
|
||||
return tmp_hasil;
|
||||
}
|
||||
_ohasil['SID'] = parseInt(Math.random() * 99999999);
|
||||
return _ohasil;
|
||||
},
|
||||
StrToFloat: function(str_val) {
|
||||
var nstr = str_val + "";
|
||||
var hasil = "";
|
||||
var fkali = 1;
|
||||
if (nstr.substr(0, 3) == "Rp.") {
|
||||
nstr = nstr.substr(3);
|
||||
if (nstr.slice(0, 4) == "Rp.") {
|
||||
nstr = nstr.slice(4);
|
||||
}
|
||||
for (var i = 0; i < nstr.length; i++) {
|
||||
if ((parseFloat(nstr.charAt(i))) || (nstr.charAt(i) == "0") || (nstr.charAt(i) == ".")) {
|
||||
@@ -604,13 +628,12 @@ var FoniaJS = {
|
||||
}
|
||||
},
|
||||
AutoComplete: function(elm, turl, aparam, func_comp, func_key){
|
||||
var arrData = [], objComp = {};
|
||||
if ('string' !== typeof aparam) arrData = this.RequestParam(aparam);
|
||||
var objComp = {};
|
||||
objComp = {
|
||||
preventEnter: true,
|
||||
resolverSettings: {
|
||||
url: turl,
|
||||
extraData: arrData.reduce(function(o, val) { var t = val.split('='); o[t[0]] = t[1]; return o; }, {})
|
||||
param: (typeof aparam === 'object') ? aparam : []
|
||||
}
|
||||
};
|
||||
if ('object' === typeof func_comp){
|
||||
@@ -652,11 +675,11 @@ class _Request {
|
||||
console.log(this.options.sendParam + ", cek url php!");
|
||||
return false;
|
||||
}
|
||||
this.options.data = FoniaJS.RequestParam(this.options.sendParam);
|
||||
this.options.data = $.extend(this.options.data, FoniaJS.RequestParam(this.options.sendParam));
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: this.options.url,
|
||||
data: (this.options.data).join('&'),
|
||||
data: this.options.data,
|
||||
success: (typeof this.options.onSuccess === "function") ? this.options.onSuccess : () => {},
|
||||
error: (typeof this.options.onFailure === "function") ? this.options.onFailure : () => {},
|
||||
complete: FoniaJS.FormDecorated,
|
||||
@@ -800,20 +823,17 @@ class _Request_JSONF extends _Request {
|
||||
var opsi = { responsive: true, columnDefs: [{responsivePriority:1,targets:0},{responsivePriority:2,targets:1},{responsivePriority:0,targets:-1}], lengthMenu: [], dom: '<"row"<"col-sm-12"tr>><"row"<"col-sm-12 col-lg-auto"<"toolbar">><"col-sm-3 col-lg-auto ms-lg-auto"l><"col-sm-9 col-lg-auto"p>>', autoWidth: false, processing: true, searching: false, columns: aSortCol, order: [[iCol, (ini.config.sort_dir=='A'?'asc':'desc')]], pageLength: ini.config.row_count, stateSave: true, stateSaveCallback: function(sett,data){localStorage.setItem(ini.id,JSON.stringify(data));}, stateLoadCallback: function(sett){try{var data=JSON.parse(localStorage.getItem(ini.id))??{};data.length=ini.config.row_count;return data;}catch(e){console.log(e)}} };
|
||||
/** start live db **/
|
||||
if (ini.config.live){
|
||||
var post_data = {};
|
||||
$(this.options.data).map((key, item) => {
|
||||
var keyval = item.split("=");
|
||||
if (keyval[0] == 'SID') keyval[1] = parseInt(Math.random() * 99999999);
|
||||
$(this.options.data).map((key, val) => {
|
||||
if (key === 'SID') val = parseInt(Math.random() * 99999999);
|
||||
// fixed bug for duplicate saving
|
||||
if (keyval[0] == 'mode_detail') keyval[1] = 'live-data';
|
||||
if ((''+keyval[1]).indexOf('%') != -1) keyval[1] = decodeURIComponent(keyval[1]);
|
||||
return post_data[keyval[0]] = keyval[1];
|
||||
if (key === 'mode_detail') val = 'live-data';
|
||||
//if ((''+val).indexOf('%') != -1) val = decodeURIComponent(val);
|
||||
});
|
||||
opsi.serverSide = true;
|
||||
opsi.ajax = {
|
||||
url: this.options.url,
|
||||
type: 'POST',
|
||||
data: post_data,
|
||||
data: this.options.data,
|
||||
dataFilter: (data) => {
|
||||
var json = {}, jsono = {'draw':0,'recordsTotal':0,'recordsFiltered':0,'data':[]};
|
||||
try {
|
||||
@@ -931,7 +951,10 @@ class _Request_JSONF extends _Request {
|
||||
// apply select function
|
||||
if (ini.config.func_select){
|
||||
$('#'+ini.id+'Tabel tbody').on('click', 'tr', (e) => {
|
||||
var dta = otabel.row(e.currentTarget).data();
|
||||
var elm = $(e.currentTarget);
|
||||
if ((elm.attr('o3') ?? '') !== '') return;
|
||||
elm.attr('o3', '1');
|
||||
var dta = otabel.row(elm).data();
|
||||
var fnc = ini.config.func_select.split('.');
|
||||
if (typeof window[fnc[0]][fnc[1]] === 'function') { window[fnc[0]][fnc[1]](dta); }
|
||||
else console.warn('fungsi '+ini.config.func_select+' tidak ada !');
|
||||
@@ -945,16 +968,19 @@ class _Request_JSONF extends _Request {
|
||||
$(ini.option).map((key, val) => {
|
||||
if (val.type == 'checkbox'){
|
||||
$('#'+ini.id+'Tabel thead input[type=checkbox][id*=_cbhead_]').on('change', (e) => {
|
||||
var _chek = e.currentTarget.is(':checked');
|
||||
e.currentTarget.val(e.currentTarget.is(':checked') ? val.avalue[0] : val.avalue[1]);
|
||||
var _etarg = $(e.currentTarget);
|
||||
var _chek = _etarg.is(':checked');
|
||||
_etarg.val(_chek ? val.avalue[0] : val.avalue[1]);
|
||||
$('#'+ini.id+'Tabel tbody input[type=checkbox][id*='+val.field+'_cbox_]').each((i, el) => {
|
||||
el.prop('checked', _chek);
|
||||
el.val(el.is(':checked') ? val.avalue[0] : val.avalue[1]);
|
||||
var _el = $(el);
|
||||
_el.prop('checked', _chek);
|
||||
_el.val(_el.is(':checked') ? val.avalue[0] : val.avalue[1]);
|
||||
});
|
||||
});
|
||||
$('#'+ini.id+'Tabel tbody input[type=checkbox][id*=_cbox_]').on('change', (e) => {
|
||||
e.currentTarget.val(e.currentTarget.val() == val.avalue[1] ? val.avalue[0] : val.avalue[1]);
|
||||
e.currentTarget.prop('checked', e.currentTarget.val() == val.avalue[0]);
|
||||
var _ctarg = $(e.currentTarget);
|
||||
_ctarg.val(_ctarg.val() == val.avalue[1] ? val.avalue[0] : val.avalue[1]);
|
||||
_ctarg.prop('checked', _ctarg.val() == val.avalue[0]);
|
||||
});
|
||||
} else if (val.type == 'button'){
|
||||
$('#'+ini.id+'Tabel tbody').on('click', '.'+val.icon, (e) => {
|
||||
|
||||
+7
-7
@@ -10,15 +10,16 @@
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cPDF = function(url, options){
|
||||
var Pdf = function(options){
|
||||
var vars = {
|
||||
'url': '',
|
||||
'zoom': 80,
|
||||
'param': []
|
||||
};
|
||||
this.construct = function(url, options){
|
||||
this.construct = function(options){
|
||||
if (typeof options == 'object') {
|
||||
$.extend(vars, options);
|
||||
vars.url = url;
|
||||
} else vars.url = options;
|
||||
};
|
||||
this.set_url = function (url){
|
||||
vars.url = url;
|
||||
@@ -35,11 +36,10 @@ var cPDF = function(url, options){
|
||||
console.warn(vars.param + ", cek url php!");
|
||||
return false;
|
||||
}
|
||||
vars.data = FoniaJS.RequestParam(vars.param);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: vars.url,
|
||||
data: (vars.data).join('&'),
|
||||
data: FoniaJS.RequestParam(vars.param),
|
||||
success: (typeof vars.onSuccess === "function") ? vars.onSuccess : null,
|
||||
error: (typeof vars.onFailure === "function") ? vars.onFailure : null,
|
||||
}).always(FoniaJS.FormDecorated);
|
||||
@@ -47,7 +47,7 @@ var cPDF = function(url, options){
|
||||
};
|
||||
this.showPDF = function(){
|
||||
var _proto = window.location.protocol + '//';
|
||||
var _src = _proto + FoniaJS.WEB_HOST + vars.url + '?' + (FoniaJS.RequestParam(vars.param)).join('&') + '#zoom='+vars.zoom+',0,0&page=1';
|
||||
var _src = _proto + FoniaJS.WEB_HOST + vars.url + '?' + $.param(FoniaJS.RequestParam(vars.param)) + '#zoom='+vars.zoom+',0,0&page=1';
|
||||
var _wtxt =
|
||||
'<div class="modal fade" id="winAPPPDF" tabindex="-1" role="dialog" data-bs-keyboard="false" data-bs-show="false" data-bs-backdrop="static" aria-labelledby="winAPPPDFLabel" aria-hidden="true">'+
|
||||
'<div class="modal-dialog modal-dialog-centered modal-fs" role="document">'+
|
||||
@@ -62,5 +62,5 @@ var cPDF = function(url, options){
|
||||
$(this).remove();
|
||||
}).modal('show');
|
||||
};
|
||||
this.construct(url, options);
|
||||
this.construct(options);
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cPOLEDISPLAY = function(port, options){
|
||||
var PoleDisplay = function(port, options){
|
||||
var _cd_port = '';
|
||||
var _cd_pole = '';
|
||||
var _options = {
|
||||
|
||||
+17
-15
@@ -4,21 +4,22 @@
|
||||
Desc. : JS Class Printer & Printer POS
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : May 27th, 2007.
|
||||
Last Modified : August 21st, 2026.
|
||||
Last Modified : September 21st, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cPRINTER = function(url, options){
|
||||
var Printer = function(options){
|
||||
var vars = {
|
||||
'url': '',
|
||||
'zoom': 90,
|
||||
'param': []
|
||||
};
|
||||
this.construct = function(url, options){
|
||||
this.construct = function(options){
|
||||
if (typeof options == 'object') {
|
||||
$.extend(vars, options);
|
||||
vars.url = url;
|
||||
} else vars.url = options;
|
||||
};
|
||||
this.set_url = function (url){
|
||||
vars.url = url;
|
||||
@@ -35,11 +36,10 @@ var cPRINTER = function(url, options){
|
||||
console.warn(vars.param + ", cek url php!");
|
||||
return false;
|
||||
}
|
||||
vars.data = FoniaJS.RequestParam(vars.param);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: vars.url,
|
||||
data: (vars.data).join('&'),
|
||||
data: FoniaJS.RequestParam(vars.param),
|
||||
success: (txt) => {
|
||||
var $printData = $('#dataPrint');
|
||||
if (!$printData.length) {
|
||||
@@ -54,11 +54,10 @@ var cPRINTER = function(url, options){
|
||||
};
|
||||
this.doPreview = function(){
|
||||
if (!vars.url) console.warn(vars.param + ", cek url php!");
|
||||
vars.data = FoniaJS.RequestParam(vars.param);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: vars.url,
|
||||
data: (vars.data).join('&'),
|
||||
data: FoniaJS.RequestParam(vars.param),
|
||||
success: (txt) => {
|
||||
if ('' == txt) {
|
||||
FoniaJS.showInfo('Tidak ada data untuk pembuatan laporan !');
|
||||
@@ -89,10 +88,10 @@ var cPRINTER = function(url, options){
|
||||
error: (typeof vars.onFailure === "function") ? vars.onFailure : null,
|
||||
});
|
||||
};
|
||||
this.construct(url, options);
|
||||
this.construct(options);
|
||||
};
|
||||
|
||||
var cPRINTERPOS = function(url, options) {
|
||||
var PrinterPos = function(options) {
|
||||
var b_default = false;
|
||||
var _options = {
|
||||
'url': '',
|
||||
@@ -105,9 +104,10 @@ var cPRINTERPOS = function(url, options) {
|
||||
'chr_sbold': "\x1B\x21\x31",
|
||||
'chr_uline': "\x1B\x21\x80"
|
||||
};
|
||||
this.construct = function(url, options) {
|
||||
this.construct = function(options) {
|
||||
if (typeof options == 'object') {
|
||||
$.extend(_options, options);
|
||||
_options.url = url;
|
||||
} else _options.url = options;
|
||||
if (FoniaJS._def_printer) _options.printer = FoniaJS._def_printer;
|
||||
};
|
||||
this.detectPrinter = function() {
|
||||
@@ -162,7 +162,7 @@ var cPRINTERPOS = function(url, options) {
|
||||
};
|
||||
this.do_print = function(nama_p, url, params) {
|
||||
var qzcfg = qz.configs.create(nama_p);
|
||||
new Request.JSON({
|
||||
new Request({
|
||||
url: url,
|
||||
sendParam: params,
|
||||
onSuccess: (ajson) => {
|
||||
@@ -181,7 +181,9 @@ var cPRINTERPOS = function(url, options) {
|
||||
ohead.push("\x1B\x40");
|
||||
ohead.push("\x1B\x61\x01");
|
||||
if (adata.config.logo != null) {
|
||||
ohead.push({type:'raw',format:'image',data:adata.config.logo,options:{language:'ESCPOS',dotDensity:'double'}});
|
||||
//ohead.push({type:'raw',format:'image',data:adata.config.logo,options:{language:'ESCPOS',dotDensity:'double'}});
|
||||
//ohead.push("\x1B\x32");
|
||||
ohead.push({type:'raw',format:'image',flavor:'base64',data:adata.config.logo,options:{language:'ESCPOS',dotDensity:'double'}});
|
||||
ohead.push("\x1B\x32");
|
||||
}
|
||||
if (parseInt(adata.config.fontsize) == 2) {
|
||||
@@ -230,5 +232,5 @@ var cPRINTERPOS = function(url, options) {
|
||||
}
|
||||
return notaout;
|
||||
};
|
||||
this.construct(url, options);
|
||||
this.construct(options);
|
||||
};
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /assets/js/share.js
|
||||
Desc. : JS Class Share File Cross Browser
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : May 27th, 2007.
|
||||
Last Modified : January 19th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cSHARE = function(url, options) {
|
||||
var _options = {
|
||||
'url': '',
|
||||
'filename': '',
|
||||
'title': '',
|
||||
'text': 'share dari aplikasi'
|
||||
};
|
||||
var _params = [];
|
||||
this.construct = function(url, options){
|
||||
if (typeof url == 'object') {
|
||||
$.extend(_options, url);
|
||||
} else {
|
||||
$.extend(_options, options);
|
||||
_options.url = url;
|
||||
}
|
||||
};
|
||||
this.set_url = function (url){
|
||||
_options.url = url;
|
||||
};
|
||||
this.add_param = function(par_id, par_val) {
|
||||
var _getvalue = (par_val) ? par_id + '=' + escape(par_val) : par_id;
|
||||
_params.push(_getvalue);
|
||||
};
|
||||
this.share = async function() {
|
||||
if (!_options.url) {
|
||||
console.warn('cek url !');
|
||||
return false;
|
||||
}
|
||||
var _pro = (window.location.protocol=='https:') ? 'https://' : 'http://';
|
||||
var _src = _pro+FoniaJS.WEB_HOST + _options.url + '?' + (FoniaJS.RequestParam(_params)).join('&');
|
||||
|
||||
try {
|
||||
const response = await fetch(_src)
|
||||
.then(response => {
|
||||
const cDispo = response.headers.get('Content-Disposition');
|
||||
if (cDispo && cDispo.indexOf('filename=') !== -1) {
|
||||
_options.filename = cDispo.split('filename=')[1].split(';')[0].replace(/"/g, '');
|
||||
}
|
||||
return response;
|
||||
});
|
||||
const blob = await response.blob();
|
||||
const file = new File([blob], _options.filename, { type: blob.type });
|
||||
|
||||
if (navigator.canShare && navigator.canShare({ files: [file] })) {
|
||||
await navigator.share({
|
||||
files: [file],
|
||||
title: _options.title ?? _options.filename,
|
||||
text: _options.text
|
||||
});
|
||||
} else {
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = _options.filename;
|
||||
link.click();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Sharing gagal:', error);
|
||||
}
|
||||
};
|
||||
this.construct(url, options);
|
||||
};
|
||||
@@ -10,14 +10,15 @@
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
var cSIMULATOR = function(url, options){
|
||||
var Simulator = function(options){
|
||||
var vars = {
|
||||
'url': '',
|
||||
'param': []
|
||||
};
|
||||
this.construct = function(url, options){
|
||||
this.construct = function(options){
|
||||
if (typeof options == 'object') {
|
||||
$.extend(vars, options);
|
||||
vars.url = url;
|
||||
} else vars.url = options;
|
||||
};
|
||||
this.set_url = function (url){
|
||||
vars.url = url;
|
||||
@@ -28,11 +29,10 @@ var cSIMULATOR = function(url, options){
|
||||
},
|
||||
this.doPreview = function(){
|
||||
if (!vars.url) console.warn(vars.param + ", cek url php!");
|
||||
vars.data = FoniaJS.RequestParam(vars.param);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: vars.url,
|
||||
data: (vars.data).join('&'),
|
||||
data: FoniaJS.RequestParam(vars.param),
|
||||
success: function(data){
|
||||
if (data.length == 0) {
|
||||
FoniaJS.showInfo('Tidak ada data !');
|
||||
@@ -80,5 +80,5 @@ var cSIMULATOR = function(url, options){
|
||||
dataType: 'json'
|
||||
});
|
||||
};
|
||||
this.construct(url, options);
|
||||
this.construct(options);
|
||||
};
|
||||
|
||||
+2
-3
@@ -21,10 +21,9 @@
|
||||
"flightphp/core": "^3.18",
|
||||
"flightphp/session": "^0.3",
|
||||
"mpdf/mpdf": ">=8.0",
|
||||
"avadim/fast-excel-writer": "^6.17",
|
||||
"matthiasmullie/minify": ">=1.3",
|
||||
"endroid/qr-code": ">=4.4",
|
||||
"phpoffice/phpspreadsheet": ">=1.29",
|
||||
"shuchkin/simplexlsxgen": "^1.3"
|
||||
"endroid/qr-code": ">=4.4"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": ["src/"],
|
||||
|
||||
+5
-4
@@ -5,7 +5,7 @@
|
||||
Module : /DB/SQL.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : February 2nd, 2007.
|
||||
Last Modified : August 21st, 2026.
|
||||
Last Modified : September 11th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Webapp\DB;
|
||||
|
||||
use ErrorException;
|
||||
use \flight\Engine;
|
||||
use \flight\Session;
|
||||
use \flight\database\SimplePdo;
|
||||
@@ -68,7 +69,7 @@ final class SQL {
|
||||
public function add_param_date(string $param = "", string|null $value = null): void {
|
||||
$this->_afield[] = [
|
||||
'field' => $param,
|
||||
'value' => tgl_sql2str(is_null($value) ? Param::Get($param) : $value),
|
||||
'value' => tgl_sql2str(is_null($value) ? Param::Get($param, '00-00-0000') : $value),
|
||||
'numbe' => false,
|
||||
];
|
||||
}
|
||||
@@ -185,8 +186,8 @@ final class SQL {
|
||||
$this->db->runQuery($tsql, $__aexec);
|
||||
}
|
||||
|
||||
public function LastInsertID(): int {
|
||||
return $this->db->lastInsertId();
|
||||
public function LastInsertID(?string $name = null): mixed {
|
||||
return $this->db->lastInsertId($name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/CSV.php
|
||||
Module : /Data/Csv.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : April 2rd, 2011.
|
||||
Last Modified : August 21st, 2026.
|
||||
@@ -19,9 +19,9 @@ define( DELI_CSV, ";" );
|
||||
define( CRLF_CSV, "\r\n" );
|
||||
|
||||
/**
|
||||
* Class CSV
|
||||
* Class Csv
|
||||
*
|
||||
* Membuat file CSV.
|
||||
* Membuat file Csv.
|
||||
*
|
||||
* @license MIT, https://www.3fonia.com
|
||||
* @copyright Copyright (c) 2008-2026, Siau Pheng <siaupheng@3fonia.com>
|
||||
@@ -29,7 +29,7 @@ define( CRLF_CSV, "\r\n" );
|
||||
* @package Webapp\Data
|
||||
*/
|
||||
|
||||
final class CSV {
|
||||
final class Csv {
|
||||
private $__avalue = [];
|
||||
private $__atabel = [];
|
||||
|
||||
|
||||
+1
-2
@@ -136,8 +136,7 @@ final class Cache {
|
||||
$_ajs = ['system/profile', 'system/chpasswd'];
|
||||
$amenu = array_values($this->web_user['Merge_Menu'] ?? []);
|
||||
$_ops = $this->db->fetchColumn("SELECT Link FROM app_menu WHERE Kode IN (?) AND Link<>'' ORDER BY Kode", [$amenu]);
|
||||
if ($_ops) $_ajs += $_ops;
|
||||
|
||||
if ($_ops) $_ajs = array_merge($_ajs, $_ops);
|
||||
$dirIterator = new \RecursiveDirectoryIterator($this->jsapp, \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||
$dirFilter = new \RecursiveCallbackFilterIterator($dirIterator, fn($curr, $key, $iter) => !($curr->isDir() && in_array($curr->getFilename(), ['locale'])));
|
||||
$iterator = new \RecursiveIteratorIterator($dirFilter);
|
||||
|
||||
+26
-26
@@ -2,7 +2,7 @@
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/PDF.php
|
||||
Module : /Data/Pdf.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : April 18th, 2015.
|
||||
Last Modified : August 21st, 2026.
|
||||
@@ -19,9 +19,9 @@ use \flight\Engine;
|
||||
use \Mpdf;
|
||||
|
||||
/**
|
||||
* Class PDF
|
||||
* Class Pdf
|
||||
*
|
||||
* Membuat file PDF.
|
||||
* Membuat file Pdf.
|
||||
*
|
||||
* @license MIT, https://www.3fonia.com
|
||||
* @copyright Copyright (c) 2008-2026, Siau Pheng <siaupheng@3fonia.com>
|
||||
@@ -29,11 +29,11 @@ use \Mpdf;
|
||||
* @package Webapp\Data
|
||||
*/
|
||||
|
||||
final class PDF {
|
||||
private $__avalue = [];
|
||||
private $__atabel = [];
|
||||
private $__theader = "";
|
||||
private $__tcolname = "";
|
||||
final class Pdf {
|
||||
private array $avalue = [];
|
||||
private array $atabel = [];
|
||||
private string $__theader = "";
|
||||
private string $__tcolname = "";
|
||||
protected array $webapp;
|
||||
protected array $webuser;
|
||||
|
||||
@@ -47,21 +47,21 @@ final class PDF {
|
||||
}
|
||||
|
||||
public function add_field(string $nama, string|int $lebar=0, string $align="L", string $func="", int $kol=1): void {
|
||||
$this->__atabel[] = [ $nama, (string)$lebar.'%', $func, $align, $kol ];
|
||||
$this->atabel[] = [ $nama, (string)$lebar.'%', $func, $align, $kol ];
|
||||
}
|
||||
|
||||
public function show_fields(): void {
|
||||
$tmp_out = "<thead><tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
if ($this->__atabel[$i][4]==0) continue;
|
||||
$tmp_out .= $this->set_align($this->__atabel[$i][0], $this->__atabel[$i][1], "C", false, true, $this->__atabel[$i][4]);
|
||||
for ($i=0; $i<count($this->atabel); $i++) {
|
||||
if ($this->atabel[$i][4]==0) continue;
|
||||
$tmp_out .= $this->set_align($this->atabel[$i][0], $this->atabel[$i][1], "C", false, true, $this->atabel[$i][4]);
|
||||
}
|
||||
$tmp_out .= "</tr></thead>";
|
||||
$this->__tcolname = $tmp_out;
|
||||
}
|
||||
|
||||
public function clear(): void {
|
||||
$this->__avalue = [];
|
||||
$this->avalue = [];
|
||||
$this->__theader = "";
|
||||
$this->__tcolname = "";
|
||||
}
|
||||
@@ -78,18 +78,18 @@ final class PDF {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
for ($i=0; $i<count($this->atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = $this->__atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
|
||||
if (is_array($this->atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = $this->atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->atabel[$i][2], $tmp_val);
|
||||
}
|
||||
$tmp_val = $this->set_align($tmp_val, $this->__atabel[$i][1], $this->__atabel[$i][3]);
|
||||
$tmp_val = $this->set_align($tmp_val, $this->atabel[$i][1], $this->atabel[$i][3]);
|
||||
$tmp_out .= $tmp_val;
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
$this->avalue[] = $tmp_out;
|
||||
}
|
||||
|
||||
public function add_span(): void {
|
||||
@@ -104,15 +104,15 @@ final class PDF {
|
||||
$tmp_out .= $tmp_val;
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
$this->avalue[] = $tmp_out;
|
||||
}
|
||||
|
||||
public function add_empty(): void {
|
||||
$this->__avalue[] = $this->set_align(" ", 0, "L,NB", true);
|
||||
$this->avalue[] = $this->set_align(" ", 0, "L,NB", true);
|
||||
}
|
||||
|
||||
public function add_stamp(int $ctk_ke=1, bool $tampil_nama=false): void {
|
||||
$this->__avalue[] = $this->set_align($this->get_stamp($ctk_ke, $tampil_nama), 0, "L,NB", true);
|
||||
$this->avalue[] = $this->set_align($this->get_stamp($ctk_ke, $tampil_nama), 0, "L,NB", true);
|
||||
}
|
||||
|
||||
public function get_stamp(int $ctk_ke=1, bool $tampil_nama=false): string {
|
||||
@@ -163,8 +163,8 @@ final class PDF {
|
||||
$html .= '<tbody>';
|
||||
|
||||
// content out
|
||||
for ($i=0; $i<count($this->__avalue); $i++) {
|
||||
$html .= $this->__avalue[$i];
|
||||
for ($i=0; $i<count($this->avalue); $i++) {
|
||||
$html .= $this->avalue[$i];
|
||||
}
|
||||
$html .= '</tbody></table></div></div></body>';
|
||||
$mpdf = new mPDF('c', 'A4'.($orien==="L"?"-L":""), $fontz, '', 5, 5, 5, 10, 5, 5);
|
||||
@@ -177,7 +177,7 @@ final class PDF {
|
||||
$tstyle = $this->create_style($dir);
|
||||
if (strpos(strtolower($text), "<tr>")===false) {
|
||||
if ($line===true) {
|
||||
return '<tr><td colspan="'.count($this->__atabel).'" class="'.$tstyle.'">'.$text."</td></tr>";
|
||||
return '<tr><td colspan="'.count($this->atabel).'" class="'.$tstyle.'">'.$text."</td></tr>";
|
||||
} else {
|
||||
return (($head===true)?"<th":"<td").(($col>1)?' colspan="'.(string)$col.'"':"").' class="'.$tstyle.'" '.(($head===true)?'width="'.(string)$width.'"':"").">".$text.(($head===true)?"</th>":"</td>");
|
||||
}
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/SimpleXLS.php
|
||||
Desc. : Class pembuatan file Simple XLS
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : November 18th, 2012.
|
||||
Last Modified : September 30th, 2025.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
//todo: deprecated
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Webapp\Data;
|
||||
|
||||
final class SimpleXLS {
|
||||
private $__wbook = null;
|
||||
private $__atabel = [];
|
||||
private $__astyle = [];
|
||||
private $__aheader = [];
|
||||
private $__amerge = [];
|
||||
private $__avalue = [];
|
||||
private $__tsheet = null;
|
||||
|
||||
public function __construct($oprop=[]) {
|
||||
$this->__wbook = new \Shuchkin\SimpleXLSXGen();
|
||||
$this->__wbook
|
||||
->setAuthor($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
|
||||
->setTitle($oprop['title'] ?? "")
|
||||
->setSubject($oprop['subject'] ?? $_SESSION['WEB_APP']['REG_NAME'])
|
||||
->setDescription($oprop['desc'] ?? "")
|
||||
->setCompany($_SESSION['WEB_APP']['REG_NAME'])
|
||||
->setDefaultFont("Calibri")
|
||||
->setDefaultFontSize(11);
|
||||
}
|
||||
|
||||
private function coord2cell($x, $y) {
|
||||
$c = '';
|
||||
for ($i = $x; $i >= 0; $i = ((int)($i / 26)) - 1) {
|
||||
$c = chr(ord('A') + $i % 26) . $c;
|
||||
}
|
||||
return $c . ($y + 1);
|
||||
}
|
||||
|
||||
private function create_style($tstyle="L") {
|
||||
$_astyle = explode(",", $tstyle);
|
||||
$_s_style = ""; $_e_style = "";
|
||||
foreach ($_astyle as $_key => $_val) {
|
||||
if ($_val == "L") {$_s_style .= '<left>'; $_e_style .= '</left>';}
|
||||
if ($_val == "R") {$_s_style .= '<right>'; $_e_style .= '</right>';}
|
||||
if ($_val == "C") {$_s_style .= '<center>'; $_e_style .= '</center>';}
|
||||
if ($_val == "W") {$_s_style .= '<wraptext>'; $_e_style .= '</wraptext>';}
|
||||
if ($_val == "B") {$_s_style .= '<b>'; $_e_style .= '</b>';}
|
||||
if ($_val == "I") {$_s_style .= '<i>'; $_e_style .= '</i>';}
|
||||
if ($_val == "S") {$_s_style .= "\0"; $_e_style .= '';}
|
||||
if ($_val == "N") {$_s_style .= '<style nf="#,##0.00">'; $_e_style .= '</style>';}
|
||||
if ($_val == "N0") {$_s_style .= '<style nf="#,##0">'; $_e_style .= '</style>';}
|
||||
}
|
||||
return ['s'=>$_s_style, 'e'=>$_e_style];
|
||||
}
|
||||
|
||||
public function clear_field() {
|
||||
$this->__atabel = [];
|
||||
}
|
||||
|
||||
public function add_header($tjudul="") {
|
||||
if ($tjudul=="") return;
|
||||
$this->__aheader[] = $tjudul;
|
||||
}
|
||||
|
||||
public function add_empty_row($nrow=1) {
|
||||
$_jkolom = count($this->__atabel);
|
||||
for ($i=0; $i<$nrow; $i++) {
|
||||
$this->__avalue[] = array_fill(0,$_jkolom,"");
|
||||
}
|
||||
}
|
||||
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="") {
|
||||
$this->__atabel[] = [$tnama, $nlebar, $ffunc];
|
||||
$this->__astyle[] = $this->create_style($talign);
|
||||
}
|
||||
|
||||
public function add_sheet($tnama_sheet="BARU", $bw_header=true) {
|
||||
$this->__tsheet = $tnama_sheet;
|
||||
$_jkolom = count($this->__atabel);
|
||||
foreach ($this->__aheader as $_key => $_val) {
|
||||
$a_out = ['<style font-size="12"><center>'.$_val."</center></style>"];
|
||||
$this->__amerge[] = $this->coord2cell(0, count($this->__avalue)) . ":" . $this->coord2cell($_jkolom-1, count($this->__avalue));
|
||||
$this->__avalue[] = $a_out;
|
||||
}
|
||||
if ($bw_header==true) $this->show_headers();
|
||||
}
|
||||
|
||||
public function add_value() {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$a_out = [];
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = $this->__atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
|
||||
}
|
||||
$a_out[] = $this->__astyle[$i]['s'] . $tmp_val . $this->__astyle[$i]['e'];
|
||||
}
|
||||
$this->__avalue[] = $a_out;
|
||||
}
|
||||
|
||||
public function add_span() {
|
||||
$tmp_arr = func_get_args();
|
||||
$a_out = [];
|
||||
for ($i=0; $i<count($tmp_arr); $i++) {
|
||||
$tmp_val = $tmp_arr[$i]; // CONTENT, COLSPAN=1, L, FUNC
|
||||
if (!isset($tmp_val[1])) $tmp_val[1] = 1;
|
||||
if (!isset($tmp_val[2])) $tmp_val[2] = "L";
|
||||
if (isset($tmp_val[3])) {
|
||||
if (function_exists($tmp_val[3]) && trim("".$tmp_val[0])<>"") {
|
||||
$tmp_val[0] = call_user_func($tmp_val[3], $tmp_val[0]);
|
||||
}
|
||||
}
|
||||
$tmp_style = $this->create_style($tmp_val[2]);
|
||||
if ($tmp_val[1]>1) $this->__amerge[] = $this->coord2cell(count($a_out), count($this->__avalue)) . ":" . $this->coord2cell((count($a_out)+$tmp_val[1])-1, count($this->__avalue));
|
||||
$a_out[] = $tmp_style['s'] . $tmp_val[0] . $tmp_style['e'];
|
||||
for ($k=1; $k<$tmp_val[1]; $k++) $a_out[] = null;
|
||||
}
|
||||
$this->__avalue[] = $a_out;
|
||||
}
|
||||
|
||||
public function add_stamp($ctk_ke=1, $bnama=false) {
|
||||
$this->__avalue[] = ["<i>".$_SESSION['WEB_APP']['APP_NAME']."v".$_SESSION['WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"")."</i>"];
|
||||
}
|
||||
|
||||
public function get_stamp($ctk_ke=1, $bnama=false) {
|
||||
return $_SESSION['WEB_APP']['APP_NAME']."v".$_SESSION['WEB_APP']['APP_VER'].date("\@ymd.His")."-".user_id(3).(($bnama==true)?"/".strtoupper(user_user()):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
}
|
||||
|
||||
public function show_headers() {
|
||||
$a_out = [];
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$a_out[] = '<style bgcolor="#D0D0D0"><center>'.$this->__atabel[$i][0].'</center></style>';
|
||||
}
|
||||
$this->__avalue[] = $a_out;
|
||||
}
|
||||
|
||||
public function send($tnama_file="File_Excel") {
|
||||
$this->__wbook->addSheet($this->__avalue, $this->__tsheet);
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$this->__wbook->setColWidth(($i+1), $this->__atabel[$i][1]);
|
||||
}
|
||||
for ($i=0; $i<count($this->__amerge); $i++) {
|
||||
$this->__wbook->mergeCells($this->__amerge[$i]);
|
||||
}
|
||||
$this->__wbook->downloadAs($tnama_file);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,156 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Data/XLS.php
|
||||
Desc. : Class pembuatan file XLS
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : November 18th, 2012.
|
||||
Last Modified : October 26th, 2023.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
//todo: deprecated
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Webapp\Data;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
|
||||
final class XLS {
|
||||
private $__tnamafile = null;
|
||||
private $__bline = true;
|
||||
private $__wbook = null;
|
||||
private $__wsheet = null;
|
||||
private $__baris = 0;
|
||||
private $__kolom = 0;
|
||||
private $__atabel = [];
|
||||
private $__astyle =[];
|
||||
private $__aheader = [];
|
||||
private $__fhead = null;
|
||||
private $__isheet = 0;
|
||||
|
||||
public function __construct($tnama_file="", $oprop=[]) {//oke
|
||||
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
|
||||
$this->__tnamafile = $tnama_file;
|
||||
$this->__wbook = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$this->__wbook->getProperties()
|
||||
->setCreator($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['WEB_APP']['APP_NAME']." v".$_SESSION['WEB_APP']['APP_VER'])
|
||||
->setTitle($oprop['title'] ?? "")
|
||||
->setSubject($oprop['subject'] ?? "")
|
||||
->setDescription($oprop['desc'] ?? "")
|
||||
->setCompany($_SESSION['WEB_APP']['REG_NAME']);
|
||||
$this->__wsheet = $this->__wbook->getActiveSheet();
|
||||
$this->__fhead = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
|
||||
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
|
||||
];
|
||||
}
|
||||
|
||||
public function create_style($tstyle="L") {//oke
|
||||
$_astyle = explode(",", $tstyle);
|
||||
$_tmp_style = [];
|
||||
$_bline = $this->__bline;
|
||||
foreach ($_astyle as $_key => $_val) {
|
||||
if ($_val == "L") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT];
|
||||
if ($_val == "R") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT];
|
||||
if ($_val == "C") $_tmp_style['alignment'] = ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER];
|
||||
if ($_val == "W") $_tmp_style['alignment'] = ['wrapText' => true];
|
||||
if ($_val == "B") $_tmp_style['font'] = ['bold' => true];
|
||||
if ($_val == "S") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT];
|
||||
if ($_val == "N") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2];
|
||||
if ($_val == "N0") $_tmp_style['numberFormat'] = ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2];
|
||||
if ($_val == "NL") $_bline = false;
|
||||
if ($_val == "H") {
|
||||
$_bline = false;
|
||||
$_tmp_style = $this->__fhead;
|
||||
}
|
||||
}
|
||||
return $_tmp_style;
|
||||
}
|
||||
|
||||
public function clear_field() {//up : 2014-06-19
|
||||
$this->__atabel = [];
|
||||
$this->__astyle = [];
|
||||
}
|
||||
|
||||
public function set_pos($nbaris=0, $nkolom=0) {
|
||||
$this->__baris = $nbaris;
|
||||
$this->__kolom = $nkolom;
|
||||
}
|
||||
|
||||
public function set_garis_bawah($bgaris=true) {}//todo: deleted
|
||||
|
||||
public function add_header($tjudul="") {//oke
|
||||
if ($tjudul=="") return;
|
||||
$this->__aheader[] = $tjudul;
|
||||
}
|
||||
|
||||
public function add_empty_row($nrow=1) {//oke
|
||||
$this->__baris += $nrow;
|
||||
}
|
||||
|
||||
public function add_field($tnama="", $nlebar=0, $talign="L", $ffunc="") {//oke
|
||||
$this->__atabel[] = [$tnama, $nlebar, $ffunc];
|
||||
$this->__astyle[] = $this->create_style($talign);
|
||||
}
|
||||
|
||||
public function add_sheet($tnama_sheet="BARU", $bw_header=true) {//not yet !!!
|
||||
if ($this->__isheet > 0) {
|
||||
$this->__wbook->createSheet();
|
||||
$this->__wsheet = $this->__wbook->setActiveSheetIndex(++$this->__isheet);
|
||||
}
|
||||
$this->__wsheet->setTitle($tnama_sheet);
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
//sampai disini dulu !!
|
||||
$this->__wsheet->getColumnDimension($this->__kolom+$i)->setWidth($this->__atabel[$i][1]);
|
||||
}
|
||||
$_fjudul = $this->__wbook->addFormat();
|
||||
$_fjudul->setBold();
|
||||
$_fjudul->setAlign("center");
|
||||
$_jkolom = count($this->__atabel);
|
||||
if ($_jkolom>0) $_jkolom--;
|
||||
foreach ($this->__aheader as $_key => $_val) {
|
||||
$this->__wsheet->write($this->__baris,$this->__kolom,$_val,$_fjudul);
|
||||
$this->__wsheet->setMerge($this->__baris,$this->__kolom,$this->__baris,$this->__kolom+$_jkolom);
|
||||
$this->__baris++;
|
||||
}
|
||||
$this->__baris++;
|
||||
if ($bw_header==true) $this->show_headers();
|
||||
}
|
||||
|
||||
public function add_value() {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$tmp_out = "";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][1]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = $this->__atabel[$i][1][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][1]) && trim($tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][1], $tmp_val);
|
||||
}
|
||||
$tmp_out .= DELI_CSV . $tmp_val;
|
||||
}
|
||||
$tmp_out = substr($tmp_out, 1);
|
||||
$this->__avalue[] = $tmp_out;
|
||||
}
|
||||
|
||||
public function send($tnama_file="File_Excel") {//oke
|
||||
$this->__wsheet->setActiveSheetIndex(0);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="'.$tnama_file.'"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = IOFactory::createWriter($this->__wsheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Data/Xls.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : November 18th, 2012.
|
||||
Last Modified : October 1st, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Webapp\Data;
|
||||
|
||||
use \flight\Engine;
|
||||
use \avadim\FastExcelWriter\Excel;
|
||||
use \avadim\FastExcelWriter\Options;
|
||||
use \avadim\FastExcelWriter\Sheet;
|
||||
use \avadim\FastExcelWriter\Style\Style;
|
||||
|
||||
/**
|
||||
* Class Xlsx
|
||||
*
|
||||
* Membuat file Excel XLSX
|
||||
*
|
||||
* @license MIT, https://www.3fonia.com
|
||||
* @copyright Copyright (c) 2008-2026, Siau Pheng <siaupheng@3fonia.com>
|
||||
*
|
||||
* @package Webapp\Data
|
||||
*/
|
||||
|
||||
final class Xlsx {
|
||||
|
||||
private Options $options;
|
||||
private Excel $excel;
|
||||
private Sheet $sheet;
|
||||
private array $webapp;
|
||||
private array $webuser;
|
||||
private array $meta = [];
|
||||
private array $titles = [];
|
||||
private array $subtitles = [];
|
||||
private array $atabel = [];
|
||||
private int $baris = 1;
|
||||
|
||||
/**
|
||||
* @param Engine $app
|
||||
*/
|
||||
|
||||
public function __construct(Engine $app) {
|
||||
$this->webapp = (array) $app->session()->get('WEB_APP', ['REG_NAME'=>'', 'APP_NAME'=>'', 'APP_VER'=>'']);
|
||||
$this->webuser = (array) $app->session()->get('WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
$this->meta = [
|
||||
'company' => $this->webapp['REG_NAME'],
|
||||
'subject' => $this->webapp['REG_NAME'],
|
||||
'author' => $this->webapp['APP_NAME'].' v'.$this->webapp['APP_VER'],
|
||||
];
|
||||
$this->options = Options::create()
|
||||
->DefaultFont([ Style::FONT_NAME => "Calibri", Style::FONT_SIZE => 11 ])
|
||||
->defaultDateFormat('DD-MM-YYYY')
|
||||
->defaultTimeFormat('HH:MM')
|
||||
->defaultDateTimeFormat('DD-MM-YYYY HH:MM');
|
||||
}
|
||||
|
||||
public function set_meta(array $meta): void {
|
||||
if (!empty($meta)) $this->meta = array_merge($this->meta, $meta);
|
||||
}
|
||||
|
||||
public function add_title(string|array $judul): void {
|
||||
if (empty($judul)) return;
|
||||
if (is_array($judul)) {
|
||||
$this->titles = $judul;
|
||||
} else array_push($this->titles, $judul);
|
||||
}
|
||||
|
||||
public function add_sub_title(string|array $judul): void {
|
||||
if (empty($judul)) return;
|
||||
if (is_array($judul)) {
|
||||
$this->subtitles = $judul;
|
||||
} else array_push($this->subtitles, $judul);
|
||||
}
|
||||
|
||||
public function add_field(string $nama="", int $lebar=0, string $style="@text", ?callable $func=null): void {
|
||||
$this->atabel[] = ['n' => $nama, 'l' => $lebar, 's' => $style, 'f' => $func];
|
||||
}
|
||||
|
||||
public function add_sheet(string $nama_sheet="BARU", bool $show_header=false): void {
|
||||
if (empty($this->excel)) {
|
||||
$this->excel = Excel::create([$nama_sheet], $this->options)
|
||||
->setCompany($this->meta['company'] ?? "")
|
||||
->setAuthor($this->meta['author'] ?? "")
|
||||
->setTitle($this->meta['title'] ?? "")
|
||||
->setDescription($this->meta['desc'] ?? "")
|
||||
->setSubject($this->meta['subject'] ?? "");
|
||||
$this->sheet = $this->excel->sheet(); //getSheet();
|
||||
} else {
|
||||
$this->sheet = $this->excel->makeSheet($nama_sheet);
|
||||
}
|
||||
if ($show_header === true) {
|
||||
$this->show_titles();
|
||||
$this->show_headers();
|
||||
}
|
||||
}
|
||||
|
||||
public function add_row(array $row): void {
|
||||
if (is_array($row) && !empty($row)) $this->sheet->writeRow($row);
|
||||
}
|
||||
|
||||
public function add_row_bold(array $row): void {
|
||||
if (is_array($row) && !empty($row)) $this->sheet->writeRow($row)->applyFontStyleBold();
|
||||
}
|
||||
|
||||
public function show_titles(): void {
|
||||
$this->baris = $this->sheet->getCurrentRow();
|
||||
$jum_kolom = count($this->atabel);
|
||||
foreach ($this->titles as $title) {
|
||||
$this->sheet->writeTo('A'.(string) $this->baris.':'.$this->excel->colLetter($jum_kolom).(string) $this->baris, $title)
|
||||
->applyFontStyleBold()
|
||||
->applyTextCenter();
|
||||
$this->baris++;
|
||||
}
|
||||
if (count($this->subtitles) > 0) {
|
||||
$this->baris++;
|
||||
foreach ($this->subtitles as $title) {
|
||||
$this->sheet->writeTo('A'.(string) $this->baris++, $title);
|
||||
}
|
||||
} else
|
||||
$this->sheet->writeTo('A'.(string) $this->baris, '');
|
||||
}
|
||||
|
||||
public function show_headers(): void {
|
||||
$this->sheet->writeHeader(array_column($this->atabel, 'n'))
|
||||
->applyFontStyleBold()
|
||||
->applyTextCenter()
|
||||
->applyBorder(Style::BORDER_STYLE_THIN);
|
||||
$this->sheet->setColFormats(array_column($this->atabel, 's'))
|
||||
->setColWidths(array_column($this->atabel, 'l'));
|
||||
}
|
||||
|
||||
public function add_stamp(int $ctk_ke=1, bool $tampil_nama=false): void {
|
||||
$this->sheet->nextRow();
|
||||
$this->sheet->writeCell($this->get_stamp($ctk_ke, $tampil_nama), ['font-size' => 8, 'font-style' => 'italic']);
|
||||
}
|
||||
|
||||
public function get_stamp(int $ctk_ke=1, bool $tampil_nama=false): string {
|
||||
return $this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($tampil_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
}
|
||||
|
||||
public function download(string $nama_file="File_Excel.xlsx"): void {
|
||||
$this->excel->download($nama_file);
|
||||
}
|
||||
|
||||
}
|
||||
+90
-73
@@ -5,7 +5,7 @@
|
||||
Module : /Printer/PrintHTML.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : August 26th, 2026.
|
||||
Last Modified : October 2nd, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -29,10 +29,12 @@ use \flight\Engine;
|
||||
*/
|
||||
|
||||
final class PrintHTML {
|
||||
private $__avalue = [];
|
||||
private $__atabel = [];
|
||||
private $__css = "table";
|
||||
private $__tstamp = "";
|
||||
private array $avalue = [];
|
||||
private array $atabel = [];
|
||||
private string $css = "table";
|
||||
private string $stamp = "";
|
||||
private array $titles = [];
|
||||
private array $subtitles = [];
|
||||
protected array $webapp;
|
||||
protected array $webuser;
|
||||
|
||||
@@ -40,96 +42,114 @@ final class PrintHTML {
|
||||
* @param Engine $app
|
||||
*/
|
||||
public function __construct(Engine $app) {
|
||||
$this->webapp = $app->session()->get('WEB_APP', ['APP_NAME'=>'', 'APP_VER'=>'']);
|
||||
$this->webuser = $app->session()->get('WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
$this->webapp = (array) $app->session()->get('WEB_APP', ['APP_NAME'=>'', 'APP_VER'=>'']);
|
||||
$this->webuser = (array) $app->session()->get('WEB_USER', ['UserID'=>0, 'Username'=>'']);
|
||||
}
|
||||
|
||||
public function set_css(string $style): void {
|
||||
if (!empty($style)) $this->__css = $style;
|
||||
if (!empty($style)) $this->css = $style;
|
||||
}
|
||||
|
||||
public function add_field(string $nama, int $lebar=0, string $align="L", string $func="", int $kol=1): void {
|
||||
$this->__atabel[] = [ $nama, $lebar, $func, $align, $kol ];
|
||||
public function add_title(string|array $judul): void {
|
||||
if (empty($judul)) return;
|
||||
if (is_array($judul)) {
|
||||
$this->titles = $judul;
|
||||
} else array_push($this->titles, $judul);
|
||||
}
|
||||
|
||||
public function clear(): void {
|
||||
$this->__avalue = [];
|
||||
public function add_sub_title(string|array $judul): void {
|
||||
if (empty($judul)) return;
|
||||
if (is_array($judul)) {
|
||||
$this->subtitles = $judul;
|
||||
} else array_push($this->subtitles, $judul);
|
||||
}
|
||||
|
||||
public function add_value(): void {
|
||||
$tmp_arr = func_get_args();
|
||||
if (is_array($tmp_arr[0])) $tmp_arr = $tmp_arr[0];
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];
|
||||
if (is_array($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") {
|
||||
$tmp_val = $this->__atabel[$i][2][$tmp_val];
|
||||
} else if (function_exists($this->__atabel[$i][2]) && trim("".$tmp_val)<>"") {
|
||||
$tmp_val = call_user_func($this->__atabel[$i][2], $tmp_val);
|
||||
}
|
||||
$tmp_val = $this->set_align((string) $tmp_val, $this->__atabel[$i][1], $this->__atabel[$i][3]);
|
||||
$tmp_out .= $tmp_val;
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
public function add_field(string $nama, int $lebar=0, string $align="L", callable|array|null $func=null, int $kol=1): void {
|
||||
$this->atabel[] = [ 'n' => $nama, 'l' => $lebar, 'f' => $func, 'a' => $align, 'k' => $kol ];
|
||||
}
|
||||
|
||||
public function add_span(): void {
|
||||
$tmp_arr = func_get_args();
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($tmp_arr); $i++) {
|
||||
$tmp_val = $tmp_arr[$i];// CONTENT, COLSPAN=1, L, FUNC, EXTRA
|
||||
if (!isset($tmp_val[1])) $tmp_val[1] = 1;
|
||||
if (!isset($tmp_val[2])) $tmp_val[2] = "L";
|
||||
if (!isset($tmp_val[4])) $tmp_val[4] = "";
|
||||
if (isset($tmp_val[3])) {
|
||||
if (function_exists($tmp_val[3]) && trim("".$tmp_val[0])<>"") {
|
||||
$tmp_val[0] = call_user_func($tmp_val[3], $tmp_val[0]);
|
||||
public function add_row(array $row): void {
|
||||
if (!is_array($row) || empty($row)) return;
|
||||
$row_out = "<tr>";
|
||||
foreach ($this->atabel as $i => $tabel) {
|
||||
$col_val = $row[$i] ?? '';
|
||||
if (!empty($col_val)) {
|
||||
if (is_array($tabel['f'])) {
|
||||
$col_val = $tabel['f'][$col_val];
|
||||
} else if (is_callable($tabel['f'])) {
|
||||
$col_val = call_user_func($tabel['f'], $col_val);
|
||||
}
|
||||
}
|
||||
$tmp_val = $this->set_align($tmp_val[0], 0, $tmp_val[2], false, false, $tmp_val[1], $tmp_val[4]);
|
||||
$tmp_out .= $tmp_val;
|
||||
$row_out .= $this->set_align((string) $col_val, $tabel['l'], $tabel['a']);
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$this->__avalue[] = $tmp_out;
|
||||
$row_out .= "</tr>";
|
||||
echo $row_out;
|
||||
}
|
||||
|
||||
public function add_stamp(int $ctk_ke=1, bool $cetak_nama=false): void {
|
||||
$this->__tstamp = $this->get_stamp($ctk_ke, $cetak_nama);
|
||||
public function add_span(array $span): void {
|
||||
if (!is_array($span) || empty($span)) return;
|
||||
$row_out = "<tr>";
|
||||
foreach ($span as $col) {
|
||||
// CONTENT, COLSPAN=1, L, FUNC, EXTRA
|
||||
if (!isset($col[1])) $col[1] = 1;
|
||||
if (!isset($col[2])) $col[2] = "L";
|
||||
if (!isset($col[4])) $col[4] = "";
|
||||
if (isset($col[3]) && is_callable($col[3])) {
|
||||
if (function_exists($col[3]) && !empty($col[0])) {
|
||||
$col[0] = call_user_func($col[3], $col[0]);
|
||||
}
|
||||
}
|
||||
$row_out .= $this->set_align($col[0], 0, $col[2], false, false, $col[1], $col[4]);
|
||||
}
|
||||
$row_out .= "</tr>";
|
||||
echo $row_out;
|
||||
}
|
||||
|
||||
public function get_stamp(int $ctk_ke=1, bool $cetak_nama=false): string {
|
||||
return $this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($cetak_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
public function show_titles(): void {
|
||||
$_afs = [0=>"4", 1=>"5", 2=>"6"];
|
||||
foreach ($this->titles as $i => $title) {
|
||||
vprintf('<div class="fs-%s text-center">%s</div>', [($_afs[$i] ?? '6'), $title]);
|
||||
|
||||
}
|
||||
if (count($this->subtitles) > 0) {
|
||||
foreach ($this->subtitles as $title) {
|
||||
vprintf('<div>%s</div>', [$title]);
|
||||
}
|
||||
} else
|
||||
echo '<br />';
|
||||
}
|
||||
|
||||
public function show(int $jumlah_ctk=1) {
|
||||
$out = "<table class=\"".$this->__css."\"><thead>";
|
||||
|
||||
// header out
|
||||
$tmp_out = "<tr>";
|
||||
for ($i=0; $i<count($this->__atabel); $i++) {
|
||||
if ($this->__atabel[$i][4]==0) continue;
|
||||
$tmp_out .= $this->set_align($this->__atabel[$i][0], $this->__atabel[$i][1], "C", false, true, $this->__atabel[$i][4]);
|
||||
public function show_headers(): void {
|
||||
vprintf('<table class="%s"><thead>', [$this->css]);
|
||||
// 0-n, 1=l, 2-f, 3-a, 4-k
|
||||
$head_out = "<tr>";
|
||||
foreach ($this->atabel as $tabel) {
|
||||
if ($tabel['k'] === 0) continue;
|
||||
$head_out .= $this->set_align($tabel['n'], $tabel['l'], "C", false, true, $tabel['k']);
|
||||
}
|
||||
$tmp_out .= "</tr>";
|
||||
$out .= "</thead>".$tmp_out."<tbody>";
|
||||
|
||||
// content out
|
||||
for ($i=0; $i<count($this->__avalue); $i++) {
|
||||
$tmp_str = $this->__avalue[$i];
|
||||
if (strpos($tmp_str, "_LINE")>0) $tmp_str = "<hr />";
|
||||
$out .= $tmp_str;
|
||||
}
|
||||
$out .= "</tbody></table>";
|
||||
$out .= $this->__tstamp;
|
||||
|
||||
for ($i=1; $i<=$jumlah_ctk; $i++) echo $out;
|
||||
$head_out .= "</tr>";
|
||||
echo "</thead>".$head_out."<tbody>";
|
||||
// start content row
|
||||
}
|
||||
|
||||
public function set_align(string $text, int $width=0, string $dir="L", bool $line=false, bool $head=false, int $col=1, string $extra=""): string {
|
||||
public function add_stamp(int $ctk_ke=1, bool $tampil_nama=false): void {
|
||||
$this->stamp = $this->get_stamp($ctk_ke, $tampil_nama);
|
||||
}
|
||||
|
||||
public function get_stamp(int $ctk_ke=1, bool $tampil_nama=false): string {
|
||||
return $this->webapp['APP_NAME']."v".$this->webapp['APP_VER'].date("\@ymd.His")."-".isi_nol($this->webuser['UserID'], 3).(($tampil_nama)?"/".strtoupper($this->webuser['Username']):"").(($ctk_ke>0)?"#".isi_nol($ctk_ke,2):"");
|
||||
}
|
||||
|
||||
public function show() {
|
||||
// end content row
|
||||
echo "</tbody></table>";
|
||||
if (!empty($this->stamp)) vprintf('<span class="small fst-italic">%s</span>', [$this->stamp]);
|
||||
}
|
||||
|
||||
public function set_align(mixed $text, int $width=0, string $dir="L", bool $line=false, bool $head=false, int $col=1, string $extra=""): string {
|
||||
$tstyle = $this->create_style($dir);
|
||||
if ($line===true) {
|
||||
return "<tr><td colspan=\"".count($this->__atabel)."\" class=\"".$tstyle." ".$extra."\">".$text."</td></tr>";
|
||||
return "<tr><td colspan=\"".count($this->atabel)."\" class=\"".$tstyle." ".$extra."\">".$text."</td></tr>";
|
||||
} else {
|
||||
return (($head===true)?"<th":"<td").(($col>1)?" colspan=\"".(string)$col."\"":"")." class=\"".$tstyle." ".$extra."\" ".(($head===true)?"width=\"".(string)$width."\"":"").">".$text.(($head===true)?"</th>":"</td>");
|
||||
}
|
||||
@@ -146,9 +166,6 @@ final class PrintHTML {
|
||||
return implode(' ', $ahasil);
|
||||
}
|
||||
|
||||
//todo: deprecated
|
||||
public function show_fields() {}
|
||||
public function add_pagebreak() {}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+27
-44
@@ -5,7 +5,7 @@
|
||||
Module : /Printer/PrintPOS.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : June 15th, 2008.
|
||||
Last Modified : August 21st, 2026.
|
||||
Last Modified : October 3rd, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -29,12 +29,11 @@ use \flight\Engine;
|
||||
*/
|
||||
|
||||
class PrintPOS {
|
||||
private $_header = [];
|
||||
private $_avalue = [];
|
||||
private $_astyle = [];
|
||||
private $_ncont = 0;
|
||||
private $_maxchr = 40;
|
||||
private $_config = [
|
||||
private int $sheet = 0;
|
||||
private int $maxchr = 40;
|
||||
private array $header = [];
|
||||
private array $acontent = [];
|
||||
private array $config = [
|
||||
'fontsize' => 1,
|
||||
'opendraw' => false,
|
||||
'cutpaper' => false,
|
||||
@@ -54,52 +53,52 @@ class PrintPOS {
|
||||
}
|
||||
|
||||
public function set_opendrawer(): void {
|
||||
$this->_config['opendraw'] = true;
|
||||
$this->config['opendraw'] = true;
|
||||
}
|
||||
|
||||
public function set_cutpaper(): void {
|
||||
$this->_config['cutpaper'] = true;
|
||||
$this->config['cutpaper'] = true;
|
||||
}
|
||||
|
||||
public function set_maxchr(int $max = 0): void {
|
||||
if ($max > 0) $this->_maxchr = $max;
|
||||
if ($max > 0) $this->maxchr = $max;
|
||||
}
|
||||
|
||||
public function set_fontsize(int $size = 1): void {
|
||||
if ($size > 0) $this->_config['fontsize'] = $size;
|
||||
if ($size > 0) $this->config['fontsize'] = $size;
|
||||
}
|
||||
|
||||
public function set_header_logo(string $logo_file = ""): void {
|
||||
if (!empty($logo_file) && file_exists(PROJECT_ROOT."assets/images/".$logo_file)) {
|
||||
$this->_config['logo'] = PROJECT_BASE."assets/images/".$logo_file;
|
||||
if (!empty($logo_file) && file_exists(PROJECT_ROOT."public/assets/images/".$logo_file)) {
|
||||
//$this->config['logo'] = PROJECT_BASE."assets/images/".$logo_file;
|
||||
$this->config['logo'] = base64_encode(file_get_contents(PROJECT_ROOT."public/assets/images/".$logo_file));
|
||||
}
|
||||
}
|
||||
|
||||
public function add_header(): void {
|
||||
$extra = func_get_args();
|
||||
if (count($extra) > 0) {
|
||||
foreach ($extra as $_val) {
|
||||
$this->_header[] = $_val;
|
||||
}
|
||||
}
|
||||
if (count($extra) > 0) $this->header = $extra;
|
||||
}
|
||||
|
||||
public function add_sheet(): void {
|
||||
$this->_ncont++;
|
||||
$this->sheet++;
|
||||
}
|
||||
|
||||
public function add(): void {
|
||||
$val_arr = func_get_args(); $ttext = ""; $tstyle = "L";
|
||||
if (is_array($val_arr[0])) {
|
||||
foreach ($val_arr as $aval) {
|
||||
$ttext .= $this->set_align((isset($aval[0])?$aval[0]:""), (isset($aval[1])?$aval[1]:0), (isset($aval[2])?$aval[2]:$tstyle));
|
||||
$ttext .= $this->set_align(($aval[0] ?? ""), ($aval[1] ?? 0), ($aval[2] ?? $tstyle));
|
||||
}
|
||||
} else {
|
||||
$ttext = (isset($val_arr[0])) ? $val_arr[0] : "";
|
||||
$tstyle = (isset($val_arr[1])) ? $val_arr[1] : $tstyle;
|
||||
$ttext = $val_arr[0] ?? "";
|
||||
$tstyle = $val_arr[1] ?? $tstyle;
|
||||
}
|
||||
$this->_avalue[$this->_ncont][] = $ttext;
|
||||
$this->_astyle[$this->_ncont][] = $tstyle;
|
||||
if (str_contains($ttext, "_LINE")) {
|
||||
$tmp_arr = explode(" ", $ttext);
|
||||
$ttext = str_pad($tmp_arr[1], $this->maxchr, $tmp_arr[1]);
|
||||
}
|
||||
$this->acontent[$this->sheet][] = ($tstyle === "X") ? $ttext : $this->set_align($ttext, $this->maxchr, $tstyle);
|
||||
}
|
||||
|
||||
public function addl(string $text = ""): void {
|
||||
@@ -127,25 +126,11 @@ class PrintPOS {
|
||||
}
|
||||
|
||||
public function show(int $jumlah_ctk=1): void {
|
||||
$acontent = [];
|
||||
$nmax = $this->_maxchr;
|
||||
|
||||
for ($s=0; $s<count($this->_avalue); $s++) {
|
||||
for ($i=0; $i<count($this->_avalue[$s]); $i++) {
|
||||
$tmp_str = $this->_avalue[$s][$i];
|
||||
if (strpos($tmp_str, "_LINE")>0) {
|
||||
$tmp_arr = explode(" ", $tmp_str);
|
||||
$tmp_str = str_pad($tmp_arr[1], $nmax, $tmp_arr[1]);
|
||||
}
|
||||
$acontent[$s][] = ($this->_astyle[$s][$i]=="X") ? $tmp_str : $this->set_align($tmp_str, $nmax, $this->_astyle[$s][$i]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->_config['times'] = $jumlah_ctk;
|
||||
$this->config['times'] = $jumlah_ctk;
|
||||
$aout = ['type' => "escp"];
|
||||
$aout['config'] = $this->_config;
|
||||
$aout['header'] = $this->_header;
|
||||
$aout['content'] = $acontent;
|
||||
$aout['config'] = $this->config;
|
||||
$aout['header'] = $this->header;
|
||||
$aout['content'] = $this->acontent;
|
||||
$this->app->json($aout);
|
||||
}
|
||||
|
||||
@@ -156,8 +141,6 @@ class PrintPOS {
|
||||
return str_pad($text, $len, " ", $apad[$dir]);
|
||||
}
|
||||
|
||||
//todo: deprecated
|
||||
public function set_printnv_logo() {}//delete
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+26
-16
@@ -5,7 +5,7 @@
|
||||
Module : /Web/Param.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : November 14th, 2013.
|
||||
Last Modified : August 22nd, 2026.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -38,40 +38,50 @@ final class Param {
|
||||
private static function __data(): void {
|
||||
global $app;
|
||||
if (empty($app)) $app = \Flight::app();
|
||||
//$_asumber = array_merge($app->request()->query->getData(), $app->request()->data->getData());
|
||||
$_asumber = $app->request()->query->getData() + $app->request()->data->getData();
|
||||
foreach ($_asumber as $__key => $__val) {
|
||||
self::$__ahasil[$__key] = is_string($__val) ? self::safeSQL($__val) : $__val;
|
||||
if (in_array($__val, ['true','false'])) { $__val = ($__val === 'true'); }
|
||||
else if (is_string($__val)) $__val = urldecode(self::safeSQL($__val));
|
||||
self::$__ahasil[$__key] = $__val;
|
||||
}
|
||||
}
|
||||
|
||||
public static function safeSQL(string $str = ""): string {
|
||||
$_se = array("\\","\0","\n","\r","\x1a","'",'"');
|
||||
$_re = array("\\\\","\\0","\\n","\\r","\Z","\'",'\"');
|
||||
$_se = ["\\","\0","\n","\r","\x1a","'",'"'];
|
||||
$_re = ["\\\\","\\0","\\n","\\r","\Z","\'",'\"'];
|
||||
return str_replace($_se, $_re, $str);
|
||||
}
|
||||
|
||||
public static function Get(string $key = "", mixed $def = null): mixed {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
if (isset(self::$__ahasil[$key]) && self::$__ahasil[$key]) return self::$__ahasil[$key];
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_Text(string $key, mixed $def = null): mixed {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
$_str = (isset(self::$__ahasil[$key])) ? self::$__ahasil[$key] : $def;
|
||||
$_str = str_replace("\\r", "", $_str);
|
||||
$_str = str_replace("\\n", " ", $_str);
|
||||
$_str = str_replace("\\t", " ", $_str);
|
||||
return (trim($_str));
|
||||
public static function Int(string $key = "", int $def = 0): int {
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return (int) self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_Array(): array {
|
||||
public static function Float(string $key = "", float $def = 0): float {
|
||||
if (empty(self::$__ahasil)) self::__data();
|
||||
if (isset(self::$__ahasil[$key])) return (float) self::$__ahasil[$key];
|
||||
return $def;
|
||||
}
|
||||
|
||||
public static function Get_All(): array {
|
||||
if (count(self::$__ahasil)==0) self::__data();
|
||||
return self::$__ahasil;
|
||||
}
|
||||
|
||||
public static function Get_ArrayCBOX() {//delete
|
||||
//delete
|
||||
public static function Get_Text(string $key, mixed $def = null): mixed {
|
||||
return self::Get($key, $def);
|
||||
}
|
||||
|
||||
//delete
|
||||
public static function Get_ArrayCBOX() {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -5,7 +5,7 @@
|
||||
Module : /Web/Table.php
|
||||
Created By : Siau Pheng (siaupheng@3fonia.com).
|
||||
Created Date : January 16th, 2008.
|
||||
Last Modified : August 27th, 2026.
|
||||
Last Modified : September 16th, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
@@ -208,6 +208,11 @@ final class Table {
|
||||
$tval = $row[$col['a']];
|
||||
if (is_array($col['f'])) {
|
||||
$tval = $col['f'][$tval];
|
||||
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
|
||||
$tclass = explode("::", $col['f']);
|
||||
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
}
|
||||
} else if (!is_null($col['f']) && function_exists($col['f'])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
} else if (is_string($tval)) {
|
||||
@@ -291,6 +296,11 @@ final class Table {
|
||||
$tval = $row[$col['a']];
|
||||
if (is_array($col['f'])) {
|
||||
$tval = $col['f'][$tval];
|
||||
} else if (!is_null($col['f']) && str_contains($col['f'], '::')) {
|
||||
$tclass = explode("::", $col['f']);
|
||||
if (class_exists($tclass[0]) && method_exists($tclass[0], $tclass[1])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
}
|
||||
} else if (!is_null($col['f']) && function_exists($col['f'])) {
|
||||
$tval = call_user_func($col['f'], $tval);
|
||||
} else if (is_string($tval)) {
|
||||
|
||||
Reference in New Issue
Block a user