Skip to content

Instantly share code, notes, and snippets.

View devfabriciobr's full-sized avatar

FABRICIO devfabriciobr

View GitHub Profile
@devfabriciobr
devfabriciobr / .php
Created November 18, 2025 00:49
PREVIEW PDF IFRAME
<?php
$element_preview = new BElement('div');
public function onShow($param = null)
{
$iframe = new TElement('iframe');
$iframe->src = 'https://pdfobject.com/pdf/sample.pdf';
$iframe->type = 'application/pdf';
@devfabriciobr
devfabriciobr / .php
Created November 12, 2025 21:36
DEBUG PHP PERSONALIZADO
<?php
# ADICIONAR NO FINAL DO ARQUIVO init.php
# EXEMPLO USO: debug($param);
function debug($data)
{
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$caller = null;
foreach ($backtrace as $frame) {
@devfabriciobr
devfabriciobr / .php
Last active November 12, 2025 20:06
CRIAR ARQUIVO LOG TXT
<?php
# SIMPLIFICADO (SEM BUFFER)
$conteudo = print_r($param, true);
file_put_contents("app/output/log.txt", $conteudo);
# COMPLETO (COM BUFFER)
ob_start();
var_dump($conteudo);
$retorno = ob_get_clean();
@devfabriciobr
devfabriciobr / .html
Last active November 12, 2025 03:31
AÇÃO CLASSE NO HREF HTML
<a generator="adianti" href="index.php?class=TelaPrincipal"> </a>
<button onclick="window.location.href='index.php?class=TelaPrincipal'"> </button>
@devfabriciobr
devfabriciobr / .php
Created November 10, 2025 23:30
EXEMPLO TQuestion SIM ou NÃO
<?php
new TQuestion("DESEJA CRIAR NOVO REGISTRO?", new TAction([__CLASS__, 'onYesNovoRegistro']),new TAction([__CLASS__, 'onNoNovoRegistro']), 'ATENÇÃO!','SIM','NÃO');
public static function onYesNovoRegistro($param = null)
{
try
{
$object = new Produto;
$object->nome = 'COCA COLA 2 LITROS';
@devfabriciobr
devfabriciobr / .php
Created November 7, 2025 17:37
ATUALIZAR FORMULÁRIO ESTATICAMENTE
<?php
# BASTA USAR O PARÂMETRO static COM O VALOR 1
TApplication::loadPage('VendaForm','onShow',['static'=>1]);
TApplication::loadPage('VendaForm','onEdit',['key'=>$id,'static'=>1]);
@devfabriciobr
devfabriciobr / .php
Created September 22, 2025 19:50
QUEBRA AUTOMÁTICA NA COLUNA DATAGRID
<?php
//<onAfterColumnsCreation>
$column_descricao->setDataProperty('style', 'word-break:break-all;');
@devfabriciobr
devfabriciobr / .php
Created September 10, 2025 23:15
EXTRAIR DADOS SEPARADOS POR VÍRGULA NA STRING
<?php
$fontes = implode(', ', $dados['fontes']);
@devfabriciobr
devfabriciobr / .php
Created September 9, 2025 19:00
AÇÃO DE SAÍDA THtmlEditor
<?php
public function onShow($param = null)
{
TScript::create("
$(document).ready(function() {
$('textarea[name=\"conteudo\"]').on('summernote.blur', function() {
alert('Você saiu do campo THtmlEditor');
});
});
@devfabriciobr
devfabriciobr / .sql
Created September 9, 2025 16:19
ALTERAR NOT NULL CAMPO TABELA
ALTER TABLE system_unit MODIFY name TEXT NULL;
ALTER TABLE system_users MODIFY name TEXT NULL;