/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); $table = new TTable(); $table->width = '100%'; // creates the form $this->form = new TForm('form_User'); $this->form->class = 'tform'; $this->form->style = 'width: 450px;margin:auto; margin-top:120px;'; // add the notebook inside the form $this->form->add($table); // create the form fields $login = new TEntry('prontuario'); $password = new TPassword('senha'); // define the sizes $login->setSize(320, 40); $password->setSize(320, 40); $login->style = 'height:35px; font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;'; $password->style = 'height:35px;margin-bottom: 15px;font-size:14px;float:left;border-bottom-left-radius: 0;border-top-left-radius: 0;'; $row = $table->addRow(); $row->addCell(new TLabel('Login'))->colspan = 2; $row->class = 'tformtitle'; $login->placeholder = 'Prontuário'; $password->placeholder = 'Senha'; $user = '******'; $locker = '<span style="float:left;width:35px;margin-left:45px;height:35px;" class="input-group-addon"><span class="glyphicon glyphicon-lock"></span></span>'; $container1 = new TElement('div'); $container1->add($user); $container1->add($login); $container2 = new TElement('div'); $container2->add($locker); $container2->add($password); $row = $table->addRow(); $row->addCell($container1)->colspan = 2; // add a row for the field password $row = $table->addRow(); $row->addCell($container2)->colspan = 2; // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Log in')); $save_button->class = 'btn btn-success btn-defualt'; $save_button->style = 'margin-left:32px;width:355px;height:40px;border-radius:6px;font-size:18px'; $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($save_button); $cell->colspan = 2; $this->form->setFields(array($login, $password, $save_button)); // add the form to the page parent::add($this->form); }
public function __construct() { parent::__construct(); $this->wrapper = new TJQueryDialog(); $this->wrapper->setUseOKButton(FALSE); $this->wrapper->setTitle(''); $this->wrapper->setSize(1000, 500); $this->wrapper->setModal(TRUE); $this->wrapper->{'widget'} = 'T' . 'Window'; parent::add($this->wrapper); }
/** * Class Constructor * @param $name Widget's name */ public function __construct($name) { // executes the parent class constructor parent::__construct($name); $this->id = 'tmultisearch' . uniqid(); $this->height = 100; $this->minLength = 5; $this->maxSize = 0; if (LANG !== 'en') { TPage::include_js('lib/adianti/include/tmultisearch/select2_locale_' . LANG . '.js'); } // creates a <select> tag $this->tag = new TElement('input'); $this->tag->{'type'} = 'hidden'; $this->tag->{'component'} = 'multisearch'; }
public static function run($debug = FALSE) { $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : ''; $static = isset($_REQUEST['static']) ? $_REQUEST['static'] : ''; $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : ''; $content = ''; set_error_handler(array('AdiantiCoreApplication', 'errorHandler')); if (class_exists($class)) { if ($static) { $rf = new ReflectionMethod($class, $method); if ($rf->isStatic()) { call_user_func(array($class, $method), $_REQUEST); } else { call_user_func(array(new $class($_GET), $method), $_REQUEST); } } else { try { $page = new $class($_GET); ob_start(); $page->show($_GET); $content = ob_get_contents(); ob_end_clean(); } catch (Exception $e) { ob_start(); if ($debug) { new TExceptionView($e); $content = ob_get_contents(); } else { new TMessage('error', $e->getMessage()); $content = ob_get_contents(); } ob_end_clean(); } } } else { if (function_exists($method)) { call_user_func($method, $_REQUEST); } else { new TMessage('error', AdiantiCoreTranslator::translate('Class ^1 not found', " <b><i><u>{$class}</u></i></b>") . '.<br>' . AdiantiCoreTranslator::translate('Check the class name or the file name') . '.'); } } if (!$static) { echo TPage::getLoadedCSS(); } echo TPage::getLoadedJS(); echo $content; }
function show() { $this->onReload(); parent::show(); }
public function __construct() { parent::__construct(); // create the notebook $this->notebook = new TNotebook(650, 200); $this->notebook->setTabsVisibility(FALSE); $this->step = new TBreadCrumb(); $this->step->addItem('Seleção', FALSE); $this->step->addItem('Importação', TRUE); $this->step->select('Seleção'); // create the form $this->form = new TForm(); // creates the notebook page $this->frmSelecao = new TTable(); $this->frmImportacao = new TTable(); $this->frmSelecao->style = 'width :640px'; $this->frmImportacao->style = 'width :640px'; // add the notebook inside the form $this->form->add($this->notebook); // adds the notebook page $this->notebook->appendPage('Seleção', $this->frmSelecao); $this->notebook->appendPage('Importação', $this->frmImportacao); //criar campo da aba selecao $file = new TFile('file'); $file->addValidation('Arquivo', new TRequiredValidator()); $file->setProperty("accept", ".xlsx,.xls"); $file->setSize('90%'); // itens pagina 1 $row = $this->frmSelecao->addRow(); $label = new TLabel('Importação da tabela'); $row->class = 'tformtitle'; $cell = $row->addCell($label); $cell->colspan = 2; $row = $this->frmSelecao->addRow(); $row->addCell(new TLabel('Local do arquivo:')); $row->addCell($file); // itens pagina 2 $this->gridSRP = new TDataGrid(); $numeroSRP = new TDataGridColumn('numeroSRP', 'SRP', 'left'); $nroProcesso = new TDataGridColumn('numeroProcesso', 'Nº Processo', 'left'); $uasg = new TDataGridColumn('uasg', 'UASG', 'left'); $validade = new TDataGridColumn('validade', 'Validade', 'left'); $natureza = new TDataGridColumn('natureza', 'Natureza de Despesa', 'left'); $nomeProcesso = new TDataGridColumn('nomeProcesso', 'Nome do Processo', 'left', 200); $this->gridSRP->addColumn($numeroSRP); $this->gridSRP->addColumn($nroProcesso); $this->gridSRP->addColumn($uasg); $this->gridSRP->addColumn($validade); $this->gridSRP->addColumn($natureza); $this->gridSRP->addColumn($nomeProcesso); $this->gridSRP->createModel(); $row = $this->frmImportacao->addRow(); $row->class = 'tformtitle'; $cell = $row->addCell(new TLabel('Confirmação da SRP para Importação')); $cell->colspan = 2; $row = $this->frmImportacao->addRow(); $cell = $row->addCell($this->gridSRP); $cell->colspan = 2; $btnLoadFile = new TButton('btnLoadFile'); $btnLoadFile->setAction(new TAction(array($this, 'onLoadFile')), 'Continuar'); $btnLoadFile->setImage('ico_next.png'); $btnImportFile = new TButton('btnImportFile'); $btnImportFile->setAction(new TAction(array($this, 'onImportFile')), 'Importar'); $btnImportFile->setImage('ico_next.png'); $this->frmSelecao->addRowSet($btnLoadFile); $this->frmSelecao->addRowSet(' '); $this->frmSelecao->addRowSet(' '); $link = new TElement('a'); $link->href = 'Files/template.xlsx'; $link->add('Link para o layout'); $this->frmSelecao->addRowSet($link); $this->frmImportacao->addRowSet($btnImportFile); // define wich are the form fields $this->form->setFields(array($file, $btnLoadFile, $btnImportFile)); // wrap the page content using vertical box $vbox = new TVBox(); //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->step); $vbox->add($this->form); parent::add($vbox); }
public function show() { if (!$this->loaded) { $this->onReload(); } parent::show(); }
public function __construct() { parent::__construct(); // create the notebook $this->notebook = new TNotebook(500, 125); $this->notebook->setTabsVisibility(FALSE); $this->step = new TBreadCrumb(); $this->step->addItem('Seleção', FALSE); $this->step->addItem('Verificação', FALSE); $this->step->addItem('Importação', TRUE); $this->step->select('Seleção'); // create the form $this->form = new TForm(); // creates the notebook page $page1 = new TTable(); $page2 = new TTable(); $page3 = new TTable(); // add the notebook inside the form $this->form->add($this->notebook); // adds the notebook page $this->notebook->appendPage('Seleção', $page1); $this->notebook->appendPage('Verificação', $page2); $this->notebook->appendPage('Importação', $page3); //criar campo da aba selecao $file = new TFile('file'); $file->setProperty("accept", ".xlsx"); $file->setSize('250px'); //campos aba verificacao $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); // add the fields into the tables $page1->addRowSet(new TLabel('Local do arquivo:'), $file); $page2->addRowSet(new TLabel('The name you:'), $field2); $page3->addRowSet(new TLabel('The name you typed:'), $field3); // creates the action buttons $button1 = new TButton('action1'); $button1->setAction(new TAction(array($this, 'onStep2')), 'Next'); $button1->setImage('ico_next.png'); $button2 = new TButton('action2'); $button2->setAction(new TAction(array($this, 'onStep1')), 'Previous'); $button2->setImage('ico_previous.png'); $button3 = new TButton('action3'); $button3->setAction(new TAction(array($this, 'onStep3')), 'Next'); $button3->setImage('ico_next.png'); $button4 = new TButton('action4'); $button4->setAction(new TAction(array($this, 'onStep2')), 'Previous'); $button4->setImage('ico_previous.png'); $button5 = new TButton('save'); $button5->setAction(new TAction(array($this, 'onSave')), 'Save'); $button5->setImage('ico_save.png'); $page1->addRowSet($button1); $page2->addRowSet($button2, $button3); $page3->addRowSet($button4, $button5); // define wich are the form fields $this->form->setFields(array($file, $field2, $field3, $button1, $button2, $button3, $button4, $button5)); // wrap the page content using vertical box $vbox = new TVBox(); //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->step); $vbox->add($this->form); parent::add($vbox); }
/** * method onGenerate() * Executed whenever the user clicks at the generate button */ function onGenerate() { try { // open a transaction with database 'saciq' TTransaction::open('saciq'); //TTransaction::setLogger(new TLoggerTXT("c:\\array\\LOG" . date("Ymd-His") . ".txt")); // get the form data into an active record $formdata = $this->form->getData(); $validadeI = $formdata->validadeI; $validadeF = TDate::date2us($formdata->validadeF); if (!$validadeI === 0) { $validadeI = '0'; } else { $validadeI = TDate::date2us($validadeI); } $this->form->validate(); $repository = new TRepository('Srp'); $criteria = new TCriteria(); $param['order'] = 'id'; $param['direction'] = 'desc'; $criteria->setProperties($param); if ($formdata->numeroProcessoI != '' && $formdata->numeroProcessoF != '') { $criteria->add(new TFilter('numeroProcesso', 'BETWEEN', "{$formdata->numeroProcessoI}", "{$formdata->numeroProcessoF}")); } if ($formdata->validadeI != '' && $formdata->validadeF != '') { $criteria->add(new TFilter('validade', 'between', "{$validadeI}", "{$validadeF}")); } if ($formdata->numeroSRPI != '' && $formdata->numeroSRPF != '') { $criteria->add(new TFilter('numeroSRP', 'between', "{$formdata->numeroSRPI}", "{$formdata->numeroSRPF}")); } if ($formdata->numeroIRPI != '' && $formdata->numeroIRPF != '') { $criteria->add(new TFilter('numeroIRP', 'between', "{$formdata->numeroIRPI}", "{$formdata->numeroIRPF}")); } $imprimeZero = true; if (isset($formdata->itensZero)) { if ($formdata->itensZero === '0') { $imprimeZero = false; } } $srps = $repository->load($criteria, true); if ($srps) { $this->pdf = new FPDF(); $this->pdf->AliasNbPages(); $this->pdf->SetMargins(10, 10, 10); $this->pdf->setHeaderCallback(array($this, 'header')); $this->pdf->setFooterCallback(array($this, 'footer')); $this->pdf->AddPage(); foreach ($srps as $srp) { $this->data = $srp; $this->srpHeader($imprimeZero); $this->srpItens($imprimeZero); } if (!file_exists("app/output/RelatorioSrp.pdf") or is_writable("app/output/RelatorioSrp.pdf")) { $this->pdf->Output("app/output/RelatorioSrp.pdf"); } else { throw new Exception('Permissão negada' . ': ' . "app/output/RelatorioSrp.pdf"); } parent::openFile("app/output/RelatorioSrp.pdf"); //new TMessage('info', 'Relatório gerado. Por favor, habilite o pop-up do seu browser.'); } else { new TMessage('error', 'Nenhum registro encontrado'); } // fill the form with the active record data $this->form->setData($formdata); // close the transaction TTransaction::close(); } catch (Exception $e) { // in case of exception if ($e->getCode() == 23000) { new TMessage('error', '<b>Registro duplicado</b><br>Verifique os campos inseridos e tente novamente'); } else { if ($e->getCode() == 0) { new TMessage('error', '<b>Error</b> <br>' . $e->getMessage()); } else { new TMessage('error', '<b>Error Desconhecido</b> <br>Código: ' . $e->getCode()); } } // desfazer todas as operacoes pendentes TTransaction::rollback(); } }
new TSession(); $menu_string = ''; if (TSession::getValue('logged')) { $content = file_get_contents("app/templates/{$template}/layout.html"); ob_start(); $callback = array('PermissaoSistema', 'checkPermission'); $xml = new SimpleXMLElement(file_get_contents('menu.xml')); $menu = new TMenu($xml, $callback, 0, 'nav collapse', ''); $menu->class = 'nav'; $menu->id = 'side-menu'; $menu->show(); $menu_string = ob_get_clean(); } else { $content = file_get_contents("app/templates/{$template}/login.html"); } $content = TApplicationTranslator::translateTemplate($content); $content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$template}/libraries.html"), $content); $content = str_replace('{URI}', $uri, $content); $content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content); $content = str_replace('{template}', $template, $content); $content = str_replace('{MENU}', $menu_string, $content); $content = str_replace('{username}', TSession::getValue('nome'), $content); $css = TPage::getLoadedCSS(); $js = TPage::getLoadedJS(); $content = str_replace('{HEAD}', $css . $js, $content); if (isset($_REQUEST['class']) and TSession::getValue('logged')) { $url = "class=Home"; //http_build_query($_REQUEST); $content = str_replace('//#javascript_placeholder#', "__adianti_load_page('engine.php?{$url}');", $content); } echo $content;
/** * method show() * Shows the page */ function show() { // checa se o datagrid ja está carregado if (!$this->loaded) { $this->onReload(func_get_arg(0)); } parent::show(); }
/** * method show() * Exibe a pagina */ function show() { // checa se o datagrid ja foi preenchido if (!$this->loaded and (!isset($_GET['method']) or $_GET['method'] !== 'onReload')) { $this->onReload(func_get_arg(0)); } parent::show(); }
/** * Show the style */ public function show() { // check if the style is already loaded if (!isset(self::$loaded[$this->name])) { $style = $this->getContent(); TPage::register_css($this->name, $style); // mark the style as loaded self::$loaded[$this->name] = TRUE; self::$styles[$this->name] = $this; } }
public function show() { if (!$this->loaded and (!isset($_GET['method']) or $_GET['method'] !== 'onReload')) { $this->onReload(func_get_arg(0)); } parent::show(); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // Cria o form $this->form = new TForm('form_Usuario'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // adiciona a tabela no form $this->form->add($table); $frame_grupos = new TFrame(NULL, 280); $frame_grupos->setLegend('Grupos'); $frame_grupos->style .= ';margin: 4px'; $frame_funcionalidades = new TFrame(NULL, 280); $frame_funcionalidades->setLegend('Funcionalidades'); $frame_funcionalidades->style .= ';margin: 15px'; // cria os campos de pesquisa do form $id = new TEntry('id'); $nome = new TEntry('nome'); $prontuario = new TEntry('prontuario'); $password = new TPassword('senha'); $repassword = new TPassword('resenha'); $email = new TEntry('email'); $multifield_funcionalidades = new TMultiField('funcionalidades'); $funcionalidade_id = new TDBSeekButton('funcionalidade_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'funcionalidades_id', 'funcionalidades_nome'); $funcionalidade_nome = new TEntry('funcionalidade_nome'); $grupos = new TDBCheckGroup('grupos', 'saciq', 'Grupo', 'id', 'nome'); //$frontpage_id = new TDBSeekButton('frontpage_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'frontpage_id', 'frontpage_nome'); //$frontpage_nome = new TEntry('frontpage_nome'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($grupos); $frame_grupos->add($scroll); $frame_funcionalidades->add($multifield_funcionalidades); // define the sizes $id->setSize(100); $nome->setSize(350); $prontuario->setSize(150); $password->setSize(150); $repassword->setSize(150); $email->setSize(250); $multifield_funcionalidades->setHeight(140); // outros $id->setEditable(false); $funcionalidade_nome->setEditable(false); $email->setProperty('autocomplete', 'off'); // validations $nome->addValidation('Nome', new TRequiredValidator()); $prontuario->addValidation('Prontuário', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(60)); $prontuario->addValidation('Prontuário', new TMaxLengthValidator(), array(60)); $email->addValidation('Email', new TMaxLengthValidator(), array(60)); $funcionalidade_id->setSize(50); $funcionalidade_nome->setSize(200); // configuracoes multifield $multifield_funcionalidades->setClass('Funcionalidade'); $multifield_funcionalidades->addField('id', 'ID', $funcionalidade_id, 60, true); $multifield_funcionalidades->addField('nome', 'Nome', $funcionalidade_nome, 250); $multifield_funcionalidades->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome: '), $nome); $table->addRowSet(new TLabel('Prontuário: '), $prontuario, new TLabel('Email: '), $email); $table->addRowSet(new TLabel('Senha: '), $password, new TLabel('Confirmação <br>da senha: '), $repassword); $row = $table->addRow(); $cell = $row->addCell($frame_grupos); $cell->colspan = 2; $cell = $row->addCell($frame_funcionalidades); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('UsuarioList', 'onReload')), 'Voltar para a listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $nome, $prontuario, $password, $repassword, $multifield_funcionalidades, $grupos, $email, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; $container = new TTable(); //$container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'UsuarioList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * method show() * Shows the page */ function show() { // check if the datagrid is already loaded if (!$this->loaded) { $this->onReload(func_get_arg(0)); } parent::show(); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_pessoa'); // creates a table $table_data = new TTable(); $table_contato = new TTable(); $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); $notebook->appendPage('Dados Principais', $table_data); $notebook->appendPage('Contatos', $table_contato); // create the form fields $idpessoa = new TEntry('idpessoa'); $nome = new TEntry('nome'); $dtcadastro = new TDate('dtcadastro'); $dtnascimento = new TDate('dtnascimento'); $natureza = new TRadioGroup('natureza'); $idramoatividade = new TDBCombo('idramoatividade', 'sobcontrole', 'ramoatividade', 'idramoatividade', 'descricao'); $obs = new TText('obs'); // add field validators $nome->addValidation('Nome', new TRequiredValidator()); $dtcadastro->addValidation('Data Cadastro', new TRequiredValidator()); $dtnascimento->addValidation('Data Nascimento', new TRequiredValidator()); $idramoatividade->addValidation('Ramo de Atividade', new TRequiredValidator()); $natureza->addValidation('Natureza', new TRequiredValidator()); $itemNatureza = array(); $itemNatureza['F'] = 'Física'; $itemNatureza['J'] = 'Jurídica'; // add the combo options $natureza->addItems($itemNatureza); $natureza->setLayout('horizontal'); // define some properties for the form fields $idpessoa->setEditable(FALSE); $idpessoa->setSize(100); $nome->setSize(320); $obs->setSize(320); $dtcadastro->setSize(90); $dtnascimento->setSize(90); $natureza->setSize(70); $idramoatividade->setSize(120); // add a row for the field code $table_data->addRowSet(new TLabel('ID:'), array($idpessoa, new TLabel('Natureza:'), $natureza)); $table_data->addRowSet(new TLabel('Nome/Fantasia:'), $nome); $table_data->addRowSet(new TLabel('Data Cadastro:'), $dtcadastro); $table_data->addRowSet(new TLabel('Data Nascimento/Início:'), $dtnascimento); $table_data->addRowSet(new TLabel('Ramo de Atividade:'), $idramoatividade); $table_data->addRowSet(new TLabel('Observações:'), $obs); $row = $table_contato->addRow(); // adiciona linha $cell = $row->addCell(new TLabel('<b>Contatos</b>')); // adiciona celular na linha $cell->valign = 'top'; // define alinhamento $listacontatos = new TMultiField('listacontatos'); // cria multifield // com TDBSeekButton //$idtipocontato= new TDBSeekButton('idtipocontato', 'sobcontrole', $this->form->getName(), 'tipocontato', 'descricao', 'listacontatos_idtipocontato', 'listacontatos_descricaotipocontato'); // com TSeekButton /*$idtipocontato= new TSeekButton('idtipocontato'); $auxidtipocontato = new BuscaTipoContato; $auxaction= new TAction(array($auxidtipocontato,'onReload')); $idtipocontato->setAction($auxaction);*/ $idtipocontato = new TDBCombo('idtipocontato', 'sobcontrole', 'tipocontato', 'idtipocontato', 'descricao', 'descricao'); $descricaotipocontato = new \Adianti\Widget\Form\THidden('tipocontato->descricao'); //$descricaotipocontato->setEditable(false); $valorcontato = new TEntry('valorcontato'); $listacontatos->setClass('contato'); // define the returning class // colunas do multifield // coluna do ID do tipo de contato (1->email, 2->telefone, etc...) $listacontatos->addField('idtipocontato', 'ID: ', $idtipocontato, 40); // coluna da descricao do tipo de contato // desta forma o grid OK $listacontatos->addField('tipocontato->descricao', '', $descricaotipocontato, 200); // desta forma o TDBSeekButton fica OK. //$listacontatos->addField('descricaotipocontato', 'Descrição Tipo Contato: ', $descricaotipocontato, 200); // coluna com o valor do contato, número do telefone, celular, etc. $listacontatos->addField('descricao', 'Valor Contato: ', $valorcontato, 200); $listacontatos->setHeight(250); $row = $table_contato->addRow(); $row->addCell($listacontatos); // create an action button $button1 = new TButton('action1'); $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $button1->setImage('ico_save.png'); // create an action button (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('PessoaDataGrid', 'onReload')), 'Listar'); $button2->setImage('ico_datagrid.gif'); $button0 = new TButton('new'); $button0->setAction(new TAction(array($this, 'onClear')), 'Novo'); $button0->setImage('ico_new.png'); // define wich are the form fields $this->form->setFields(array($idpessoa, $nome, $dtcadastro, $dtnascimento, $natureza, $idramoatividade, $obs, $listacontatos, $button0, $button1, $button2)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button0); $row->addCell($button1); $row->addCell($button2); // wrap the page content $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); $vbox->add($subtable); // add the form inside the page parent::add($vbox); }
/** * method show() * Shows the page */ function show() { // check if the datagrid is already loaded if (!$this->loaded and (!isset($_GET['method']) or $_GET['method'] !== 'onReload')) { $this->onReload(func_get_arg(0)); } parent::show(); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Campus'); $this->form->class = 'tform'; // CSS class //$this->form->style = 'width: 500px'; // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de Câmpus'))->colspan = 2; // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $uasg = new TEntry('uasg'); $sigla = new TEntry('sigla'); $id->setEditable(FALSE); // define the sizes $id->setSize(50); $nome->setSize(400); $uasg->setSize(150); $sigla->setSize(100); // validations $nome->addValidation('Nome', new TRequiredValidator()); $uasg->addValidation('UASG', new TRequiredValidator()); $sigla->addValidation('Sigla', new TRequiredValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(50)); $uasg->addValidation('UASG', new TMaxLengthValidator(), array(10)); $sigla->addValidation('Sigla', new TMaxLengthValidator(), array(3)); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet($label_nome = new TLabel('Nome:'), $nome); //$label_nome->setFontColor('#FF0000'); $table->addRowSet($label_uasg = new TLabel('UASG:'), $uasg); //$label_uasg->setFontColor('#FF0000'); $table->addRowSet($label_sigla = new TLabel('Sigla:'), $sigla); //$label_sigla->setFontColor('#FF0000'); $this->form->setFields(array($id, $nome, $uasg, $sigla)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), 'Salvar', 'ico_save.png'); $new_button = TButton::create('new', array($this, 'onEdit'), 'Novo', 'ico_new.png'); $back_button = TButton::create('back', array('CampusList', 'onReload'), 'Voltar para a listagem', 'ico_datagrid.png'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($back_button); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); $buttons_box->add($back_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; $container = new TTable(); //$container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'CampusList')); $container->addRow()->addCell($this->form); parent::add($container); }