/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     // creates the form
     $this->form = new TForm('form_System_Provider');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new provider'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nif = new TEntry('nif');
     $name = new TEntry('name');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $nif->setSize(300);
     $name->setSize(300);
     // validations
     $nif->addValidation('nif', new TRequiredValidator());
     $name->addValidation('name', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('NIF: '), $nif);
     $table->addRowSet(new TLabel('Name: '), $name);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemProvidersList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $nif, $name, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProvidersList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Document');
     $this->form->add($this->notebook);
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Document')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $title = new TEntry('title');
     $content = new THtmlEditor('content');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $title->setSize(200, 40);
     $content->setSize(680, 350);
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Title') . ': '), $title);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($content);
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Content') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $title, $content, $save_button));
     $table->addRowSet($save_button, '')->class = 'tformaction';
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Add a multi-cell content to a table cell
  * @param $cells Each argument is a row cell
  */
 public function addMultiCell()
 {
     $wrapper = new THBox();
     $args = func_get_args();
     if ($args) {
         foreach ($args as $arg) {
             $wrapper->add($arg);
         }
     }
     $this->addCell($wrapper);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TForm('form_Usuario');
     $this->form->class = 'tform';
     // CSS class
     // 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('Usuario'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $login = new TEntry('login');
     $senha = new TPassword('senha');
     // define the sizes
     $id->setSize(100);
     $login->setSize(200);
     $senha->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('login:'******'senha:'), $senha);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $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')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($id, $login, $senha, $save_button, $new_button));
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     //
     // creates the form
     $this->form = new TForm('form_SystemUser');
     $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('Troque sua senha'))->colspan = 2;
     // create the form fields
     $current = new TPassword('current');
     $current->addValidation('Senha atual', new TRequiredValidator());
     $password = new TPassword('password');
     $password->addValidation('Nova senha', new TRequiredValidator());
     $confirmation = new TPassword('confirmation');
     $confirmation->addValidation('Confirmação', new TRequiredValidator());
     // define the sizes
     $current->setSize(200);
     $password->setSize(200);
     $confirmation->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('Senha atual'), $current);
     $table->addRowSet(new TLabel('Nova senha'), $password);
     $table->addRowSet(new TLabel('Confirmação'), $confirmation);
     $this->form->setFields(array($current, $password, $confirmation));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), 'Alterar senha', 'ico_save.png');
     $this->form->addField($save_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     $notebook1 = new TNotebook();
     $notebook2 = new TNotebook();
     $notebook1->appendPage('page1', new TLabel('Page 1'));
     $notebook1->appendPage('page2', new TLabel('Page 2'));
     $notebook2->appendPage('page1', new TLabel('Page 1'));
     $notebook2->appendPage('page2', new TLabel('Page 2'));
     $notebook1->setSize(200, 100);
     $notebook2->setSize(200, 100);
     // creates the horizontal box
     $hbox = new THBox();
     $hbox->add($notebook1);
     $hbox->add($notebook2);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($hbox);
     parent::add($vbox);
 }
Example #7
0
 public function __construct()
 {
     parent::__construct();
     // pega o html que sera alterado
     $this->menu = new THtmlRenderer('app/resources/menu.html');
     $this->produtos = new THtmlRenderer('app/resources/produtos.html');
     // ativa a sessão principal
     $replace = array();
     $this->menu->enableSection('main', $replace);
     $this->produtos->enableSection('main', $replace);
     try {
         TTransaction::open('sample');
         $criteria = new TCriteria();
         $criteria->add(new TFilter('id', '>', 0));
         $categorias = Categoria::getObjects($criteria);
         TTransaction::close();
         //cria um array vario
         $replace_detail = array();
         if ($categorias) {
             // iterate products
             foreach ($categorias as $c) {
                 // adicio os itens no array
                 // a função toArray(), transforma o objeto em um array
                 // passando assim para a $variavel
                 $replace_detail[] = $c->toArray();
             }
         }
         // ativa a sessão e substitui as variaveis
         //o parametro true quer dizer que é um loop
         $this->menu->enableSection('manager', $replace_detail, TRUE);
         $box = new THBox();
         $box->add($this->menu);
         $box->add($this->produtos);
         parent::add($box);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
     parent::add($this->html);
 }
Example #8
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     $hbox1 = new THBox();
     $hbox2 = new THBox();
     $table->style = 'width: 100%';
     $table1->style = 'width: 100%';
     $table2->style = 'width: 100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('User')), '', '', '')->class = 'tformtitle';
     $table->addRowSet($hbox1);
     $table->addRowSet($hbox2);
     $hbox1->add($table1);
     $hbox1->add($table2);
     // add the table inside the form
     $this->form->add($table);
     $frame_groups = new TFrame(NULL, 280);
     $frame_groups->setLegend(_t('Groups'));
     $frame_groups->style .= ';margin: 4px';
     $frame_programs = new TFrame(NULL, 280);
     $frame_programs->setLegend(_t('Programs'));
     $frame_programs->style .= ';margin: 4px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 240);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize('50%');
     $name->setSize('100%');
     $login->setSize('100%');
     $password->setSize('100%');
     $repassword->setSize('100%');
     $email->setSize('100%');
     $frontpage_id->setSize('20%');
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', _t('Name'), $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $row = $table1->addRow();
     $row->addCell(new TLabel('ID:'))->style = 'width:150px';
     $row->addCell($id);
     $table1->addRowSet(new TLabel(_t('Login') . ': '), $login);
     $table1->addRowSet(new TLabel(_t('Password') . ': '), $password);
     $table1->addRowSet(new TLabel(_t('Password confirmation') . ': '), $repassword);
     $row = $table2->addRow();
     $row->addCell(new TLabel('Name:'))->style = 'width:150px';
     $row->addCell($name);
     $table2->addRowSet(new TLabel(_t('Email') . ': '), $email);
     $table2->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id);
     $table2->addRowSet(new TLabel(_t('Page name') . ': '), $frontpage_name);
     $hbox2->add($frame_groups);
     $hbox2->add($frame_programs);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_search_PlantaValores');
     $this->form->class = 'tform';
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Planta de Valores'), '')->class = 'tformtitle';
     $this->form->add($table);
     $plantavalores_id = new TEntry('plantavalores_id');
     $plantavalores_id->setValue(TSession::getValue('plantavalores_id'));
     $anobase = new TEntry('anobase');
     $anobase->setValue(TSession::getValue('anobase'));
     $row = $table->addRowSet(new TLabel('ID: '), $plantavalores_id);
     $row = $table->addRowSet(new TLabel('Ano Base: '), $anobase);
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('PlantaValoresForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($plantavalores_id, $anobase, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     $plantavalores_id = new TDataGridColumn('plantavalores_id', 'ID', 'right');
     $anobase = new TDataGridColumn('anobase', 'Ano Base', 'left');
     $this->datagrid->addColumn($plantavalores_id);
     $this->datagrid->addColumn($anobase);
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'plantavalores_id');
     $plantavalores_id->setAction($order_id);
     $order_data = new TAction(array($this, 'onReload'));
     $order_data->setParameter('order', 'anobase');
     $anobase->setAction($order_data);
     $action1 = new TDataGridAction(array('PlantaValoresForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('anobase_id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('plantavalores_id');
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->createModel();
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServList');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Frequência'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     //$id = new TEntry('ID');
     //$id->setValue(TSession::getValue('Frequencia_id'));
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServList', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_id->setValue(TSession::getValue('Frequencia_servidor_id'));
     $servidor_nome = new TEntry('servidor_nome');
     $servidor_nome->setValue(TSession::getValue('Frequencia_servidor_nome'));
     $diames = new TDate('Data');
     $diames->setValue(TSession::getValue('Frequencia_diames'));
     //$id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $diames->setMask('dd/mm/yyyy');
     // add rows for the filter fields
     //$row=$table->addRowSet(new TLabel(('ID') . ': '), $id);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $row = $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRowSet(new TLabel('Data' . ': '), $diames);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new Tbutton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('FrequenciaServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     $this->form->setFields(array($servidor_id, $servidor_nome, $diames, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $servidor_nome = new TDataGridColumn('servidor_nome', 'Nome', 'left', 200);
     $diames = new TDataGridColumn('diames', 'Data', 'center', 50);
     $entrada = new TDataGridColumn('entrada', 'Entrada', 'center', 40);
     $intervalo_inicio = new TDataGridColumn('intervalo_inicio', 'Saída', 'center', 50);
     $intervalo_fim = new TDataGridColumn('intervalo_fim', 'Entrada', 'center', 50);
     $saida = new TDataGridColumn('saida', 'Saída', 'center', 50);
     $ausencia_desc = new TDataGridColumn('ausencia_desc', 'Ausência', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($servidor_nome);
     $this->datagrid->addColumn($diames);
     $this->datagrid->addColumn($entrada);
     $this->datagrid->addColumn($intervalo_inicio);
     $this->datagrid->addColumn($intervalo_fim);
     $this->datagrid->addColumn($saida);
     $this->datagrid->addColumn($ausencia_desc);
     $order_servidor_nome = new TAction(array($this, 'onReload'));
     $order_servidor_nome->setParameter('order', 'servidor_nome');
     $servidor_nome->setAction($order_servidor_nome);
     $order_diames = new TAction(array($this, 'onReload'));
     $order_diames->setParameter('order', 'diames');
     $diames->setAction($order_diames);
     // inline editing
     $servidor_entrada_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_entrada_edit->setField('id');
     $entrada->setEditAction($servidor_entrada_edit);
     $servidor_intervalo_inicio_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_inicio_edit->setField('id');
     $intervalo_inicio->setEditAction($servidor_intervalo_inicio_edit);
     $servidor_intervalo_fim_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_fim_edit->setField('id');
     $intervalo_fim->setEditAction($servidor_intervalo_fim_edit);
     $servidor_saida_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_saida_edit->setField('id');
     $saida->setEditAction($servidor_saida_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('FrequenciaServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     $action3 = new TDataGridAction(array('FrequenciaServidorForm', 'onFrequencia'));
     $action3->setLabel('Informação');
     $action3->setImage('fa:info-circle blue');
     $action3->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->style = 'width: 750px';
     $this->form->add($table);
     $table->width = '100%';
     $this->form->class = 'tform';
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $user = new TEntry('user');
     $status = new TEntry('status');
     $project = new TEntry('project');
     $priority = new TEntry('priority');
     $category = new TEntry('category');
     $id_release = new TEntry('id_release');
     $member = new TEntry('member');
     $register_date = new TEntry('register_date');
     $close_date = new TEntry('close_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $solution = new THtmlEditor('solution');
     $user->setEditable(FALSE);
     $status->setEditable(FALSE);
     $project->setEditable(FALSE);
     $priority->setEditable(FALSE);
     $category->setEditable(FALSE);
     $id_release->setEditable(FALSE);
     $member->setEditable(FALSE);
     $register_date->setEditable(FALSE);
     $close_date->setEditable(FALSE);
     $time->setEditable(FALSE);
     $title->setEditable(FALSE);
     $description->setEditable(FALSE);
     $solution->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $user->setSize(200);
     $status->setSize(200);
     $project->setSize(200);
     $priority->setSize(200);
     $category->setSize(200);
     $id_release->setSize(100);
     $member->setSize(200);
     $register_date->setSize(100);
     $close_date->setSize(100);
     $time->setSize(200);
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $solution->setSize(680, 300);
     $register_date->setMask('yyyy-mm-dd');
     $close_date->setMask('yyyy-mm-dd');
     $id->setEditable(FALSE);
     $table1->addRowSet(new TLabel('ID:'), $id);
     $table1->addRowSet(new TLabel(_t('User') . ': '), $user);
     $table1->addRowSet(new TLabel(_t('Status') . ': '), $status);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $category);
     $table2->addRowSet(new TLabel(_t('Release') . ': '), $id_release);
     $table2->addRowSet(new TLabel(_t('Assigned to')), $member);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), $register_date);
     $table2->addRowSet(new TLabel(_t('Due date') . ':'), $close_date);
     $table2->addRowSet(new TLabel(_t('Time') . ':'), $time);
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $notes_area = new THtmlEditor('notes_area');
     $notes_area->setEditable(FALSE);
     $notes_area->setSize(680, 300);
     $subnotebook = new TNotebook();
     $subnotebook->setSize(710, 330);
     $subnotebook->appendPage(_t('Description'), $description);
     $subnotebook->appendPage(_t('Solution'), $solution);
     $subnotebook->appendPage(_t('Notes'), $notes_area);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($subnotebook);
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // define wich are the form fields
     $this->form->setFields(array($id, $user, $status, $project, $priority, $category, $id_release, $member, $register_date, $close_date, $time, $title, $description, $solution, $notes_area));
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_search_Release');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Releases')), '')->class = 'tformtitle';
     // create the form fields
     $filter = new TEntry('name');
     $filter->setValue(TSession::getValue('Release_name'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $buttons = new THBox();
     $buttons->add($find_button);
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') {
         $class = 'ReleaseForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
         $buttons->add($new_button);
     }
     TTransaction::close();
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 50);
     $id_project = new TDataGridColumn('project', _t('Project'), 'left', 200);
     $name = new TDataGridColumn('name', _t('Name'), 'left', 300);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order3 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'id_project');
     $order3->setParameter('order', 'name');
     // assign the ordering actions
     $id->setAction($order1);
     $id_project->setAction($order2);
     $name->setAction($order3);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($id_project);
     $this->datagrid->addColumn($name);
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') {
         // creates two datagrid actions
         $class = 'ReleaseForm';
         $action1 = new TDataGridAction(array($class, 'onEdit'));
         $action1->setLabel(_t('Edit'));
         $action1->setImage('ico_edit.png');
         $action1->setField('id');
         $action2 = new TDataGridAction(array($this, 'onDelete'));
         $action2->setLabel(_t('Delete'));
         $action2->setImage('ico_delete.png');
         $action2->setField('id');
         // add the actions to the datagrid
         $this->datagrid->addAction($action1);
         $this->datagrid->addAction($action2);
     } else {
         // creates two datagrid actions
         $class = 'ViewReleaseForm';
         $action1 = new TDataGridAction(array($class, 'onView'));
         $action1->setLabel(_t('View'));
         $action1->setImage('ico_view.png');
         $action1->setField('id');
         // add the actions to the datagrid
         $this->datagrid->addAction($action1);
     }
     TTransaction::close();
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     $frame_programs = new TFrame();
     // creates the form
     $this->form = new TForm('form_System_Receipt');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new receipt'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $client = new TDBCombo('client', 'permission', 'SystemClients', 'name', 'name');
     $amount = new TEntry('account_money');
     $date = new TDate('date');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $client->setSize(300);
     $amount->setSize(300);
     $date->setSize(300);
     // validations
     $client->addValidation('client', new TRequiredValidator());
     $amount->addValidation('account_money', new TRequiredValidator());
     $date->addValidation('date', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Client: '), $client);
     $table->addRowSet(new TLabel('Account money: '), $amount);
     $table->addRowSet(new TLabel('Date: '), $date);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemInvoicesList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $client, $amount, $date, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemInvoicesList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
Example #14
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(640, 350);
     parent::setTitle('Event');
     // creates the form
     $this->form = new TForm('form_Event');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 600px';
     // 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('Event'))->colspan = 2;
     $hours = array();
     $durations = array();
     for ($n = 0; $n < 24; $n++) {
         $hours[$n] = "{$n}:00";
         $durations[$n + 1] = $n + 1 . ' h';
     }
     array_pop($durations);
     // create the form fields
     $id = new TEntry('id');
     $event_date = new TDate('event_date');
     $start_hour = new TCombo('start_hour');
     $duration = new TCombo('duration');
     $title = new TEntry('title');
     $description = new TText('description');
     $start_hour->addItems($hours);
     $duration->addItems($durations);
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(40);
     $event_date->setSize(100);
     $start_hour->setSize(100);
     $duration->setSize(100);
     $title->setSize(400);
     $description->setSize(400, 50);
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Event Date:'), $event_date);
     $table->addRowSet(new TLabel('Start Hour:'), $start_hour);
     $table->addRowSet(new TLabel('Duration:'), $duration);
     $table->addRowSet(new TLabel('Title:'), $title);
     $table->addRowSet(new TLabel('Description:'), $description);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $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')), _t('Clear'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($id, $event_date, $start_hour, $duration, $title, $description, $save_button, $new_button));
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Ticket');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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('Ticket'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $id->setMask('99999');
     $titulo = new TEntry('titulo');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria);
     $solicitante_nome = new TEntry('solicitante_nome');
     $solicitante_nome->setEditable(FALSE);
     $criteria = new TCriteria();
     $criteria->add(new TFilter('enttipent', '=', 1));
     $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria);
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome', 'nome');
     // define the sizes
     $id->setSize(50);
     $titulo->setSize(274);
     $solicitante_id->setSize(50);
     $solicitante_nome->setSize(200);
     $entcodent->setSize(274);
     $status_ticket_id->setSize(100);
     $tipo_ticket_id->setSize(200);
     $sistema_id->setSize(200);
     $responsavel_id->setSize(274);
     $prioridade_id->setSize(100);
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Titulo:'), $titulo);
     $table->addRowSet(new TLabel('Cliente:'), array($solicitante_id, $solicitante_nome));
     $table->addRowSet(new TLabel('Entidade:'), $entcodent);
     $table->addRowSet(new TLabel('Responsável:'), $responsavel_id);
     $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id);
     $table->addRowSet(new TLabel('Sistema:'), $sistema_id);
     $table->addRowSet(new TLabel('Status:'), $status_ticket_id);
     $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $this->form->setFields(array($id, $titulo, $solicitante_id, $solicitante_nome, $entcodent, $status_ticket_id, $tipo_ticket_id, $responsavel_id, $prioridade_id, $sistema_id));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Ticket_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $new_button = TButton::create('new', array('TicketForm', 'onEdit'), _t('New'), 'fa:plus-square green');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     $buttons_box->add($clean_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $status_ticket_id = new TDataGridColumn('status_ticket_id', 'S', 'center', 20);
     $id = new TDataGridColumn('id', 'ID', 'left', 20);
     $titulo = new TDataGridColumn('titulo', 'Titulo', 'left', 250);
     $solicitante_id = new TDataGridColumn('solicitante_id', 'Cliente', 'left', 250);
     $responsavel_id = new TDataGridColumn('pessoa_responsavel->pessoa_nome', 'Responsavel', 'left', 100);
     $prioridade_id = new TDataGridColumn('prioridade->nome', 'Pri', 'right', 20);
     //get_prioridade()->nome
     $status_ticket_id->setTransformer(array($this, 'retornaStatus'));
     $solicitante_id->setTransformer(array($this, 'retornaCliente'));
     $responsavel_id->setTransformer(array($this, 'retornaPessoa'));
     $prioridade_id->setTransformer(array($this, 'retornaPrioridade'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($status_ticket_id);
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($titulo);
     $this->datagrid->addColumn($solicitante_id);
     $this->datagrid->addColumn($responsavel_id);
     $this->datagrid->addColumn($prioridade_id);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_titulo = new TAction(array($this, 'onReload'));
     $order_titulo->setParameter('order', 'titulo');
     $titulo->setAction($order_titulo);
     $order_status_ticket_id = new TAction(array($this, 'onReload'));
     $order_status_ticket_id->setParameter('order', 'status_ticket_id');
     $status_ticket_id->setAction($order_status_ticket_id);
     $order_prioridade_id = new TAction(array($this, 'onReload'));
     $order_prioridade_id->setParameter('order', 'prioridade->nome');
     $prioridade_id->setAction($order_prioridade_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('TicketForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
Example #16
0
 function __construct()
 {
     parent::__construct();
     $table = new TTable();
     $table->style = "width:100%";
     $frame_proprietarios = new TFrame();
     $frame_proprietarios->setLegend('Proprietarios');
     $frame_inf = new TFrame();
     $frame_inf->setLegend('Informações do Logradouro');
     $this->form = new TForm('form_Imovel');
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel('Imóvel'), '', '', '')->class = 'tformtitle';
     $imovel_id = new TEntry('imovel_id');
     $logradouro = new TEntry('logradouro');
     $numero = new TEntry('numero');
     $quadra = new TEntry('quadra');
     $lote = new TEntry('lote');
     $multifield1 = new TMultiField('proprietarios');
     $proprietarios_id = new TDBSeekButton('proprietarios_id', 'liger', 'form_Imovel', 'Contribuinte', 'contribuinte_nome', 'proprietarios_proprietarios_id', 'proprietarios_contribuinte_nome');
     $contribuinte_nome = new TEntry('contribuinte_nome');
     $inflogradouro = new TCheckGroup('inflogradouro');
     $inflogradouro->addItems(array('1' => 'Pavimentação   ', '2' => 'Meio Fio   ', '3' => 'Galerias Pluviais   ', '4' => 'Arborização   ', '5' => 'Rede Elétrica   ', '6' => 'Inluminação Pública   ', '7' => 'Rede D\'Água   ', '8' => 'Rede de Esgoto   ', '9' => 'Coleta de Lixo   '));
     $inflogradouro->setLayout('horizontal');
     $tipopropriedade = new TCombo('tipopropriedade');
     $tipopropriedade->addItems(array('1' => 'Particular', '2' => 'Municipal', '3' => 'Estadual', '4' => 'Federal', '5' => 'Religiosa'));
     $situacaojuridica = new TCombo('situacaojuridica');
     $situacaojuridica->addItems(array('1' => 'Plena', '2' => 'Poseiro', '3' => 'Aforamento', '4' => 'Litigiosa'));
     $localizacao = new TCombo('localizacao');
     $localizacao->addItems(array('1' => 'Esquina', '2' => 'Encravado', '3' => 'Meio de Quadra', '4' => 'Toda Quadra', '5' => 'Gleba'));
     $ocupacao = new TCombo('ocupacao');
     $ocupacao->addItems(array('1' => 'Vago', '2' => 'Edificado', '3' => 'Edificação Temporaria', '4' => 'Edificação em Construção', '5' => 'Construção Paralizada', '6' => 'Edificação em Demolição', '7' => 'Edificação em Ruinas', '8' => 'Praça'));
     $numfrentes = new TEntry('numfrentes');
     $utilizacao = new TCombo('utilizacao');
     $utilizacao->addItems(array('1' => 'Própria', '2' => 'Alugada', '3' => 'Cedida', '4' => 'Desocupada', '5' => 'Fechada'));
     $tipo = new TCombo('tipo');
     $tipo->addItems(array('1' => 'Casa', '2' => 'Apartamento', '3' => 'Sala', '4' => 'Loja', '5' => 'Galpão'));
     $douso = new TCombo('douso');
     $douso->addItems(array('1' => 'Residencial', '2' => 'Comercial', '3' => 'Industrial', '4' => 'Religioso', '5' => 'Administração Pública', '6' => 'Serviços'));
     $agua = new TCombo('agua');
     $agua->addItems(array('1' => 'Sem', '2' => 'Cisterna', '3' => 'Com Pena DÁgua', '4' => 'Hidrometro'));
     $esgoto = new TCombo('esgoto');
     $esgoto->addItems(array('1' => 'Sem', '2' => 'Fossa Negra', '3' => 'Fossa Septica', '4' => 'Rede Pública'));
     $areaterreno = new TEntry('areaterreno');
     $testada = new TEntry('testada');
     $areaedificada = new TEntry('areaedificada');
     $areatotaledificada = new TEntry('areatotaledificada');
     $imgimovel = new TEntry('imgimovel');
     $frame_proprietarios->add($multifield1);
     $multifield1->setHeight(140);
     $multifield1->setClass('Proprietarios');
     $multifield1->addField('proprietarios_id', 'Contribuinte' . ' ID', $proprietarios_id, 100, true);
     $multifield1->addField('contribuinte_nome', 'Nome', $contribuinte_nome, 250);
     $multifield1->setOrientation('horizontal');
     $imovel_id->setEditable(false);
     $contribuinte_nome->setEditable(false);
     $imovel_id->setSize(100);
     $logradouro->setSize(250);
     $quadra->setSize(100);
     $lote->setSize(100);
     $numero->setSize(100);
     $numfrentes->setSize(100);
     $table->addRowSet(new TLabel('ID:'), $imovel_id, new TLabel('Logradouro: '), $logradouro);
     $table->addRowSet(new TLabel('Quadra: '), $quadra, new TLabel('Lote: '), $lote);
     $table->addRowSet(new TLabel('Número: '), $numero, new TLabel('Nº de Frentes: '), $numfrentes);
     $table->addRowSet(new TLabel('Propriedade: '), $tipopropriedade, new TLabel('Situação Juridica: '), $situacaojuridica);
     $table->addRowSet(new TLabel('Localização: '), $localizacao, new TLabel('Ocupação: '), $ocupacao);
     $table->addRowSet(new TLabel('Utilização: '), $utilizacao, new TLabel('Tipo: '), $tipo);
     $table->addRowSet(new TLabel('Do Uso: '), $douso, new TLabel('Água: '), $agua);
     $table->addRowSet(new TLabel('Esgoto: '), $esgoto);
     $table->addRowSet(new TLabel('Área do Terreno: '), $areaterreno);
     $table->addRowSet(new TLabel('Testada: '), $testada);
     $table->addRowSet(new TLabel('Área Edificada: '), $areaedificada);
     $table->addRowSet(new TLabel('Área Total Edificada: '), $areatotaledificada);
     $table->addRowSet(new TLabel('Imagem do Imóvel: '), $imgimovel);
     $frame_inf->add($inflogradouro);
     $row1 = $table->addRow();
     $cell = $row1->addCell($frame_inf);
     $cell->colspan = 4;
     $row = $table->addRow();
     $cell = $row->addCell($frame_proprietarios);
     $cell->colspan = 4;
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('ImovelList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('ico_datagrid.png');
     $this->form->setFields(array($imovel_id, $logradouro, $multifield1, $inflogradouro, $tipopropriedade, $situacaojuridica, $localizacao, $ocupacao, $numero, $quadra, $lote, $numfrentes, $utilizacao, $tipo, $douso, $agua, $esgoto, $areaterreno, $testada, $areaedificada, $areatotaledificada, $imgimovel, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'ImovelList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_Atividade');
     $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('Atividade'))->colspan = 2;
     // busca dados do banco
     try {
         TTransaction::open('atividade');
         $logado = Pessoa::retornaUsuario();
         $ultimoPonto = Ponto::retornaUltimoPonto($logado->pessoa_codigo);
         $ponto = new Ponto($ultimoPonto);
         if ($ponto->hora_saida) {
             $action = new TAction(array('PontoFormList', 'onReload'));
             new TMessage('error', 'Não existe ponto com horario em aberto!', $action);
         }
         $data_padrao = $string->formatDateBR($ponto->data_ponto);
         $hora_padrao = Ponto::retornaHoraInicio($string->formatDate($data_padrao), $logado->pessoa_codigo);
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
     }
     // create the form fields
     $id = new THidden('id');
     $data_atividade = new TEntry('data_atividade');
     $data_atividade->setMask('dd/mm/yyyy');
     $data_atividade->setValue($data_padrao);
     $data_atividade->setEditable(FALSE);
     $hora_inicio = new TEntry('hora_inicio');
     $hora_inicio->setEditable(FALSE);
     $hora_inicio->setValue($hora_padrao);
     $hora_fim = new THidden('hora_fim');
     $hora_fim->setEditable(FALSE);
     $tempo_atividade = new TEntry('tempo_atividade');
     $tempo_atividade->setEditable(FALSE);
     $qtde_horas = new TCombo('qtde_horas');
     $qtde_minutos = new TCombo('qtde_minutos');
     $descricao = new TText('descricao');
     $colaborador_id = new THidden('colaborador_id');
     $colaborador_id->setValue($logado->pessoa_codigo);
     $colaborador_nome = new TEntry('colaborador_nome');
     $colaborador_nome->setEditable(FALSE);
     $colaborador_nome->setValue($logado->pessoa_nome);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $ticket_id = new TCombo('ticket_id');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("status_ticket_id", "IN", array(1, 5)));
     $newparam['order'] = 'id';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $this->onComboTicket($criteria);
     $horario = explode(':', $hora_padrao);
     // cria combos de horas e minutos
     $combo_horas = array();
     for ($i = 8; $i <= 18; $i++) {
         $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_horas->addItems($combo_horas);
     $qtde_horas->setValue($horario[0]);
     $qtde_horas->setDefaultOption(FALSE);
     $combo_minutos = array();
     for ($i = 0; $i <= 59; $i++) {
         $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_minutos->addItems($combo_minutos);
     $qtde_minutos->setValue($horario[1]);
     $qtde_minutos->setDefaultOption(FALSE);
     // set exit action for input_exit
     $change_action = new TAction(array($this, 'onChangeAction'));
     $qtde_horas->setChangeAction($change_action);
     $qtde_minutos->setChangeAction($change_action);
     $change_atividade_action = new TAction(array($this, 'onTrocaTipoAtividade'));
     $tipo_atividade_id->setChangeAction($change_atividade_action);
     $change_ticket_action = new TAction(array($this, 'onTrocaTicket'));
     $ticket_id->setChangeAction($change_ticket_action);
     // define the sizes
     $id->setSize(100);
     $data_atividade->setSize(100);
     $hora_inicio->setSize(100);
     $hora_fim->setSize(100);
     $qtde_horas->setSize(60);
     $qtde_minutos->setSize(60);
     $tempo_atividade->setSize(100);
     $descricao->setSize(300, 80);
     $colaborador_id->setSize(200);
     $tipo_atividade_id->setSize(200);
     $ticket_id->setSize(300);
     // validações
     $tempo_atividade->addValidation('Hora Fim', new THoraFimValidator());
     $tipo_atividade_id->addValidation('Tipo de Atividade', new TRequiredValidator());
     $ticket_id->addValidation('Ticket', new TRequiredValidator());
     $sistema_id->addValidation('Sistema', new TRequiredValidator());
     $descricao->addValidation('Descrição', new TMinLengthValidator(), array(10));
     $sem_atividade = TButton::create('atividade', array($this, 'onSemAtividade'), 'Sem Registro', 'ico_add.png');
     $this->form->addField($sem_atividade);
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_nome);
     $table->addRowSet(new TLabel('Data Atividade:'), array($data_atividade, $label_data = new TLabel('Data do último ponto')));
     $label_data->setFontColor('#A9A9A9');
     $table->addRowSet(new TLabel('Hora Inicio:'), $hora_inicio);
     $table->addRowSet($label_qtde_horas = new TLabel('Hora Fim:'), array($qtde_horas, $qtde_minutos, $sem_atividade));
     $label_qtde_horas->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Tempo Atividade:'), $tempo_atividade);
     $table->addRowSet($label_atividade = new TLabel('Tipo Atividade:'), $tipo_atividade_id);
     $label_atividade->setFontColor('#FF0000');
     $table->addRowSet($label_ticket = new TLabel('Ticket:'), $ticket_id);
     $label_ticket->setFontColor('#FF0000');
     $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id);
     $label_sistema->setFontColor('#FF0000');
     $table->addRowSet($label_descricao = new TLabel('Descrição:'), $descricao);
     $label_descricao->setFontColor('#FF0000');
     $table->addRowSet(new TLabel(''), $id);
     $table->addRowSet(new TLabel(''), $colaborador_id);
     $table->addRowSet(new TLabel(''), $hora_fim);
     //esconder
     $this->form->setFields(array($id, $data_atividade, $hora_inicio, $qtde_horas, $qtde_minutos, $hora_fim, $tempo_atividade, $descricao, $colaborador_id, $colaborador_nome, $tipo_atividade_id, $ticket_id, $sistema_id));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green');
     $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg');
     $list_button = TButton::create('list', array('AtividadeList', 'onClean'), _t('List'), 'fa:table blue');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($del_button);
     $this->form->addField($list_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     $buttons_box->add($del_button);
     $buttons_box->add($list_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     //                        TScript::create(' $( "#descricao" ).focus(); ');
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Servidor');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Servidores'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $identificacao = new TEntry('identificacao');
     $identificacao->setValue(TSession::getValue('Servidor_identificacao'));
     $servidor = new TEntry('servidor');
     $servidor->setValue(TSession::getValue('Servidor_servidor'));
     //$unidade = new TEntry('unidade');
     //$unidade->setValue(TSession::getValue('Servidor_unidade'));
     // add rows for the filter fields
     $row = $table->addRowSet(new TLabel('Identificação' . ': '), $identificacao);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new TButton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('ServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     //$this->form->setFields(array($identificacao, $servidor, $unidade, $find_button, $new_button));
     $this->form->setFields(array($identificacao, $servidor, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $identificacao = new TDataGridColumn('identificacao', 'Identificação', 'left');
     $servidor = new TDataGridColumn('servidor', 'Servidor', 'left');
     $unidade = new TDataGridColumn('unidade', 'Unidade', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($identificacao);
     $this->datagrid->addColumn($servidor);
     $this->datagrid->addColumn($unidade);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_identificacao = new TAction(array($this, 'onReload'));
     $order_identificacao->setParameter('order', 'identificacao');
     $identificacao->setAction($order_identificacao);
     $order_servidor = new TAction(array($this, 'onReload'));
     $order_servidor->setParameter('order', 'servidor');
     $servidor->setAction($order_servidor);
     $order_unidade = new TAction(array($this, 'onReload'));
     $order_unidade->setParameter('order', 'unidade');
     $unidade->setAction($order_unidade);
     // inline editing
     $identificacao_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $identificacao_edit->setField('id');
     $identificacao->setEditAction($identificacao_edit);
     $servidor_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_edit->setField('id');
     $servidor->setEditAction($servidor_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('ServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_SystemProgram');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel(_t('Programs')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('SystemProgram_name'));
     $control = new TEntry('controller');
     $control->setValue(TSession::getValue('SystemProgram_control'));
     // add rows for the filter fields
     $row = $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     $row = $table->addRowSet(new TLabel(_t('Controller') . ': '), $control);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('SystemProgramForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     // define wich are the form fields
     $this->form->setFields(array($name, $control, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right');
     $name = new TDataGridColumn('name', _t('Name'), 'left');
     $controller = new TDataGridColumn('controller', _t('Controller'), 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($controller);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'name');
     $name->setAction($order_name);
     $order_controller = new TAction(array($this, 'onReload'));
     $order_controller->setParameter('order', 'controller');
     $controller->setAction($order_controller);
     // inline editing
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('id');
     $name->setEditAction($name_edit);
     $controller_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $controller_edit->setField('id');
     $controller->setEditAction($controller_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('SystemProgramForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     new TSession();
     // creates the form
     $this->form = new TForm('form_search_product');
     // create the form fields
     $description = new TEntry('description');
     $description->setSize(170);
     $description->setValue(TSession::getValue('product_description'));
     $table = new TTable();
     $row = $table->addRow();
     $cell = $row->addCell('');
     $cell->width = 50;
     $row->addCell($description);
     // creates the action button
     $button1 = new TButton('find');
     $button1->setAction(new TAction(array($this, 'onSearch')), 'Find');
     $button1->setImage('ico_find.png');
     $row->addCell($button1);
     $this->form->add($table);
     $this->form->setFields(array($description, $button1));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->cartgrid = new TQuickGrid();
     //$this->datagrid->makeScrollable();
     $this->cartgrid->makeScrollable();
     $this->datagrid->setHeight(230);
     $this->cartgrid->setHeight(220);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('ID', 'id', 'right', 25);
     $this->datagrid->addQuickColumn('Description', 'description', 'left', 190);
     $this->datagrid->addQuickColumn('Price', 'sale_price', 'right', 50);
     $this->cartgrid->addQuickColumn('ID', 'id', 'right', 25);
     $this->cartgrid->addQuickColumn('Description', 'description', 'left', 190);
     $this->cartgrid->addQuickColumn('Price', 'sale_price', 'right', 50);
     // creates datagrid actions
     $this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'id', 'ico_apply.png');
     $this->cartgrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     $this->cartgrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table1 = new TTable();
     $table1->addRow()->addCell($this->form)->height = '50';
     $table1->addRow()->addCell($this->datagrid);
     $table1->addRow()->addCell($this->pageNavigation);
     $this->total = new TLabel('');
     $this->total->setFontStyle('b');
     $table2 = new TTable();
     $table2->addRow()->addCell($this->total)->height = '50';
     $table2->addRow()->addCell($this->cartgrid);
     $hbox = new THBox();
     $hbox->add($table1)->style .= 'vertical-align:top';
     $hbox->add($table2)->style .= 'vertical-align:top';
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($hbox);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     $this->string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_search_Atividade');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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('Atividade'))->colspan = 2;
     // create the form fields
     $id = new THidden('id');
     $data_atividade_inicial = new TDate('data_atividade_inicial');
     $data_atividade_inicial->setMask('dd/mm/yyyy');
     $data_atividade_final = new TDate('data_atividade_final');
     $data_atividade_final->setMask('dd/mm/yyyy');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("usuario", "is not "));
     $colaborador_id = new TDBCombo('colaborador_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $ticket_id = new TDBMultiSearch('ticket_id', 'atividade', 'Ticket', 'id', 'titulo', 'titulo');
     $pesquisa_master = new TEntry('pesquisa_master');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria);
     $solicitante_nome = new TEntry('solicitante_nome');
     $solicitante_nome->setEditable(FALSE);
     $total_atividades = new TEntry('total_atividades');
     $total_atividades->setEditable(FALSE);
     // define the sizes
     $id->setSize(50);
     $data_atividade_inicial->setSize(100);
     $data_atividade_final->setSize(100);
     $colaborador_id->setSize(300);
     $tipo_atividade_id->setSize(300);
     $ticket_id->setMinLength(0);
     $ticket_id->setMaxSize(1);
     $ticket_id->setSize(300);
     $ticket_id->setOperator('ilike');
     $solicitante_id->setSize(40);
     $solicitante_nome->setSize(235);
     $total_atividades->setSize(100);
     $pesquisa_master->setSize(300);
     // add one row for each form field
     $table->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome));
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Dt. Atividades inicio:'), array($data_atividade_inicial, $label_data_fim = new TLabel('Fim:'), $data_atividade_final));
     $label_data_fim->setSize(48);
     $table->addRowSet(new TLabel('Atividade:'), $tipo_atividade_id);
     $table->addRowSet(new TLabel('Ticket:'), $ticket_id);
     $table->addRowSet(new TLabel('Pesquisa por palavra:'), $pesquisa_master);
     $table->addRowSet(new TLabel('Total horas atividades:'), $total_atividades);
     $table->addRowSet(new TLabel(''), $id);
     $this->form->setFields(array($id, $data_atividade_inicial, $data_atividade_final, $colaborador_id, $tipo_atividade_id, $ticket_id, $solicitante_id, $solicitante_nome, $pesquisa_master, $total_atividades));
     $change_data = new TAction(array($this, 'onChangeData'));
     $data_atividade_inicial->setExitAction($change_data);
     $data_atividade_final->setExitAction($change_data);
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Atividade_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $new_button = TButton::create('new', array('AtividadeForm', 'onEdit'), _t('New'), 'fa:plus-square green');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     $buttons_box->add($clean_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $data_atividade = new TDataGridColumn('data_atividade', 'Data', 'right', 40);
     $hora_inicio = new TDataGridColumn('hora_inicio', 'Inicio', 'right', 20);
     $hora_fim = new TDataGridColumn('hora_fim', 'Fim', 'right', 20);
     $hora_qte = new TDataGridColumn('hora_qte', 'Qtde', 'right', 20);
     $colaborador_id = new TDataGridColumn('pessoa->pessoa_nome', 'Colaborador', 'left', 50);
     $tipo_atividade_id = new TDataGridColumn('tipo_atividade->nome', 'Atividade', 'left', 100);
     //get_tipo_atividade()->nome
     $sistema_id = new TDataGridColumn('sistema->nome', 'Sistema', 'left', 100);
     $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'left', 200);
     // get_ticket()->titulo
     // transformers
     $colaborador_id->setTransformer(array($this, 'retornaPessoa'));
     $hora_qte->setTransformer(array($this, 'calculaDiferenca'));
     $data_atividade->setTransformer(array('StringsUtil', 'formatDateBR'));
     $hora_inicio->setTransformer(array('StringsUtil', 'retira_segundos'));
     $hora_fim->setTransformer(array('StringsUtil', 'retira_segundos'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($data_atividade);
     $this->datagrid->addColumn($hora_inicio);
     $this->datagrid->addColumn($hora_fim);
     $this->datagrid->addColumn($hora_qte);
     $this->datagrid->addColumn($colaborador_id);
     $this->datagrid->addColumn($tipo_atividade_id);
     $this->datagrid->addColumn($sistema_id);
     $this->datagrid->addColumn($ticket_id);
     // creates the datagrid column actions
     $order_data_atividade = new TAction(array($this, 'onReload'));
     $order_data_atividade->setParameter('order', 'data_atividade');
     $data_atividade->setAction($order_data_atividade);
     $order_colaborador_id = new TAction(array($this, 'onReload'));
     $order_colaborador_id->setParameter('order', 'pessoa->pessoa_nome');
     $colaborador_id->setAction($order_colaborador_id);
     $order_tipo_atividade_id = new TAction(array($this, 'onReload'));
     $order_tipo_atividade_id->setParameter('order', 'tipo_atividade->nome');
     $tipo_atividade_id->setAction($order_tipo_atividade_id);
     $order_sistema_id = new TAction(array($this, 'onReload'));
     $order_sistema_id->setParameter('order', 'sistema->nome');
     $sistema_id->setAction($order_sistema_id);
     $order_ticket_id = new TAction(array($this, 'onReload'));
     $order_ticket_id->setParameter('order', 'ticket->titulo');
     $ticket_id->setAction($order_ticket_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('AtividadeForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
Example #22
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_search_Issue');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Issues')), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'description_translated');
     $filter_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $filter_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $filter_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $filter_title = new TEntry('title');
     $filter_status->setValue(TSession::getValue('Issue_id_status'));
     $filter_project->setValue(TSession::getValue('Issue_id_project'));
     $filter_priority->setValue(TSession::getValue('Issue_id_priority'));
     $filter_category->setValue(TSession::getValue('Issue_id_category'));
     $filter_title->setValue(TSession::getValue('Issue_title'));
     $filter_title->setSize(480);
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Status') . ': '));
     $row->addCell($filter_status);
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($filter_project);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Priority') . ': '));
     $row->addCell($filter_priority);
     $row->addCell(new TLabel(_t('Category') . ': '));
     $row->addCell($filter_category);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($filter_title);
     $cell->colspan = 3;
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') {
         $class = 'NewIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     } else {
         $class = 'UpdateIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     }
     TTransaction::close();
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     // define wich are the form fields
     $this->form->setFields(array($filter_status, $filter_project, $filter_priority, $filter_category, $filter_title, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 50);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 260);
     $id_status = new TDataGridColumn('status', _t('Status'), 'left', 100);
     $id_priority = new TDataGridColumn('priority', _t('Priority'), 'left', 100);
     $id_category = new TDataGridColumn('category', _t('Category'), 'left', 100);
     $register_date = new TDataGridColumn('register_date', _t('Start date'), 'left', 110);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order3 = new TAction(array($this, 'onReload'));
     $order4 = new TAction(array($this, 'onReload'));
     $order5 = new TAction(array($this, 'onReload'));
     $order6 = new TAction(array($this, 'onReload'));
     $order7 = new TAction(array($this, 'onReload'));
     $order8 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'title');
     $order3->setParameter('order', 'id_status');
     $order4->setParameter('order', 'id_priority');
     $order5->setParameter('order', 'id_category');
     $order6->setParameter('order', 'register_date');
     // assign the ordering actions
     $id->setAction($order1);
     $title->setAction($order2);
     $id_status->setAction($order3);
     $id_priority->setAction($order4);
     $id_category->setAction($order5);
     $register_date->setAction($order6);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($title);
     $this->datagrid->addColumn($id_status);
     $this->datagrid->addColumn($id_priority);
     $this->datagrid->addColumn($id_category);
     $this->datagrid->addColumn($register_date);
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') {
         // creates two datagrid actions
         $class = 'UpdateIssueForm';
         $action1 = new TDataGridAction(array($class, 'onEdit'));
         $action1->setLabel(_t('Edit'));
         $action1->setImage('ico_edit.png');
         $action1->setField('id');
         $action2 = new TDataGridAction(array($this, 'onDelete'));
         $action2->setLabel(_t('Delete'));
         $action2->setImage('ico_delete.png');
         $action2->setField('id');
         // add the actions to the datagrid
         $this->datagrid->addAction($action1);
         $this->datagrid->addAction($action2);
     } else {
         if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MEMBER') {
             // creates two datagrid actions
             $class = 'UpdateIssueForm';
             $action1 = new TDataGridAction(array($class, 'onEdit'));
             $action1->setLabel(_t('Edit'));
             $action1->setImage('ico_edit.png');
             $action1->setField('id');
             // add the actions to the datagrid
             $this->datagrid->addAction($action1);
         }
     }
     // creates two datagrid actions
     $class = 'ViewIssueForm';
     $action3 = new TDataGridAction(array($class, 'onView'));
     $action3->setLabel(_t('View'));
     $action3->setImage('ico_view.png');
     $action3->setField('id');
     $class = 'NoteForm';
     $action4 = new TDataGridAction(array($class, 'onEdit'));
     $action4->setLabel(_t('Comment'));
     $action4->setImage('ico_new.png');
     $action4->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action4);
     TTransaction::close();
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
Example #23
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_System_user');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel(_t('Users')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $id->setValue(TSession::getValue('System_user_id'));
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('System_user_name'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search');
     $new_button->setAction(new TAction(array('SystemUserForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     // add a row for the form actions
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     $this->datagrid->style = 'width: 100%';
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $name = new TDataGridColumn('name', _t('Name'), 'center');
     $login = new TDataGridColumn('login', _t('Login'), 'center');
     $email = new TDataGridColumn('email', _t('Email'), 'center');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($login);
     $this->datagrid->addColumn($email);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'name');
     $name->setAction($order_name);
     $order_login = new TAction(array($this, 'onReload'));
     $order_login->setParameter('order', 'login');
     $login->setAction($order_login);
     $order_email = new TAction(array($this, 'onReload'));
     $order_email->setParameter('order', 'email');
     $email->setAction($order_email);
     // inline editing
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('id');
     $name->setEditAction($name_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('SystemUserForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o grey fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Example #24
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     $frame_programs = new TFrame();
     // creates the form
     $this->form = new TForm('form_System_RRHH');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $table->addRowSet(new TLabel('Employees'), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $dni = new TEntry('dni');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $email = new TEntry('email');
     $phone = new TEntry('phone');
     // define the sizes
     $id->setSize(100);
     $dni->setSize(100);
     $name->setSize(200);
     $address->setSize(200);
     $email->setSize(200);
     $phone->setSize(200);
     // validations
     $dni->addValidation('dni', new TRequiredValidator());
     $name->addValidation('name', new TRequiredValidator());
     $address->addValidation('addres', new TRequiredValidator());
     $email->addValidation('email', new TRequiredValidator());
     $phone->addValidation('phone', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $dni);
     $table->addRowSet(new TLabel('DNI:'), $dni);
     $table->addRowSet(new TLabel('Name: '), $name);
     $table->addRowSet(new TLabel('Address: '), $address);
     $table->addRowSet(new TLabel('Email: '), $email);
     $table->addRowSet(new TLabel('Phone: '), $phone);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemStockList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $dni, $name, $address, $email, $phone, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemRRHHList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_RequisitoDesenvolvimento');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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 DRs'))->colspan = 2;
     // create the form fields
     $id = new TEntry('ticket_id');
     $id->setMask('99999');
     $titulo = new TEntry('titulo');
     $data_cadastro = new TDate('data_cadastro');
     $data_cadastro->setMask('dd/mm/yyyy');
     // define the sizes
     $id->setSize(50);
     $titulo->setSize(200);
     $data_cadastro->setSize(100);
     // add one row for each form field
     $table->addRowSet(new TLabel('Ticket:'), $id);
     $table->addRowSet(new TLabel('Título:'), $titulo);
     $table->addRowSet(new TLabel('Data:'), $data_cadastro);
     $this->form->setFields(array($id, $titulo, $data_cadastro));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('RequisitoDesenvolvimento_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($clean_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('ticket_id', 'ID', 'right', 20);
     $data_cadastro = new TDataGridColumn('data_cadastro', 'Data', 'left', 80);
     $titulo = new TDataGridColumn('titulo', 'Título', 'left', 300);
     $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'right', 300);
     $data_cadastro->setTransformer(array('StringsUtil', 'formatDateBR'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($data_cadastro);
     $this->datagrid->addColumn($titulo);
     $this->datagrid->addColumn($ticket_id);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_titulo = new TAction(array($this, 'onReload'));
     $order_titulo->setParameter('order', 'titulo');
     $titulo->setAction($order_titulo);
     $order_data_cadastro = new TAction(array($this, 'onReload'));
     $order_data_cadastro->setParameter('order', 'data_cadastro');
     $data_cadastro->setAction($order_data_cadastro);
     $order_ticket_id = new TAction(array($this, 'onReload'));
     $order_ticket_id->setParameter('order', 'ticket->titulo');
     $ticket_id->setAction($order_ticket_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('RequisitoDesenvolvimentoForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_System_Employees');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Employees'), '');
     $cell1->colspan = 2;
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $id->setValue(TSession::getValue('s_id'));
     $dni = new TEntry('dni');
     $dni->setValue(TSession::getValue('s_dni'));
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('s_name'));
     $address = new TEntry('address');
     $address->setValue(TSession::getValue('s_address'));
     $email = new TEntry('email');
     $email->setValue(TSession::getValue('s_email'));
     $phone = new TEntry('phone');
     $phone->setValue(TSession::getValue('s_phone'));
     $id->setSize(100);
     $dni->setSize(300);
     $name->setSize(300);
     $address->setSize(300);
     $email->setSize(300);
     $phone->setSize(300);
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($id);
     $row = $table->addRow();
     $row->addCell(new TLabel('DNI:'));
     $row->addCell($dni);
     $row = $table->addRow();
     $row->addCell(new TLabel('Name: '));
     $row->addCell($name);
     $row = $table->addRow();
     $row->addCell(new TLabel('Address: '));
     $row->addCell($address);
     $row = $table->addRow();
     $row->addCell(new TLabel('Email: '));
     $row->addCell($email);
     $row = $table->addRow();
     $row->addCell(new TLabel('Phone: '));
     $row->addCell($phone);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $pdf_button = new TButton('pdf');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search');
     $new_button->setAction(new TAction(array('SystemEmployeesForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $pdf_button->setAction(new TAction(array($this, 'onPDF')), 'PDF');
     $pdf_button->setImage('fa:file-pdf-o red');
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $container->add($pdf_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $dni, $name, $address, $email, $phone, $find_button, $new_button, $pdf_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $dni = new TDataGridColumn('dni', 'DNI', 'center');
     $name = new TDataGridColumn('name', 'Name', 'center');
     $address = new TDataGridColumn('address', 'Address', 'center');
     $email = new TDataGridColumn('email', 'Email', 'center');
     $phone = new TDataGridColumn('phone', 'Phone', 'center');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($dni);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($address);
     $this->datagrid->addColumn($email);
     $this->datagrid->addColumn($phone);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_dni = new TAction(array($this, 'onReload'));
     $order_dni->setParameter('order', 'dni');
     $dni->setAction($order_dni);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'name');
     $name->setAction($order_name);
     $order_address = new TAction(array($this, 'onReload'));
     $order_address->setParameter('order', 'address');
     $address->setAction($order_address);
     $order_email = new TAction(array($this, 'onReload'));
     $order_email->setParameter('order', 'email');
     $email->setAction($order_email);
     $order_phone = new TAction(array($this, 'onReload'));
     $order_phone->setParameter('order', 'phone');
     $phone->setAction($order_phone);
     // inline editing
     $dni_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $dni_edit->setField('id');
     $dni->setEditAction($dni_edit);
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('id');
     $name->setEditAction($name_edit);
     $address_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $address_edit->setField('id');
     $address->setEditAction($address_edit);
     $email_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $email_edit->setField('id');
     $email->setEditAction($email_edit);
     $phone_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $phone_edit->setField('id');
     $phone->setEditAction($phone_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('SystemEmployeesForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o grey fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     $frame_programs = new TFrame();
     $frame_programs->setLegend(_t('Programs'));
     // creates the form
     $this->form = new TForm('form_System_group');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Group')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $multifield = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_group', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $frame_programs->add($multifield);
     $multifield->setHeight(140);
     $multifield->setClass('SystemProgram');
     $multifield->addField('id', _t('Program') . ' ID', $program_id, 100, true);
     $multifield->addField('name', _t('Name'), $program_name, 250);
     $multifield->setOrientation('horizontal');
     // define the sizes
     $program_id->setSize(70);
     $id->setSize(100);
     $name->setSize(200);
     // validations
     $name->addValidation('name', new TRequiredValidator());
     // outras propriedades
     $id->setEditable(false);
     $program_name->setEditable(false);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     // add a row for the field name
     $row = $table->addRow();
     $cell = $row->addCell($frame_programs);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $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')), _t('New'));
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemGroupList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $multifield, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemGroupList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_search_Contribuinte');
     $this->form->class = 'tform';
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Contribuinte'), '')->class = 'tformtitle';
     $this->form->add($table);
     $contribuinte_id = new TEntry('contribuinte_id');
     $contribuinte_id->setValue(TSession::getValue('contribuinte_id'));
     $contribuinte_nome = new TEntry('contribuinte_nome');
     $contribuinte_nome->setValue(TSession::getValue('contribuinte_nome'));
     $row = $table->addRowSet(new TLabel('ID: '), $contribuinte_id);
     $row = $table->addRowSet(new TLabel('Nome/Razão Social: '), $contribuinte_nome);
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('ContribuinteForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($contribuinte_id, $contribuinte_nome, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     $contribuinte_id = new TDataGridColumn('contribuinte_id', 'ID', 'right');
     $contribuinte_nome = new TDataGridColumn('contribuinte_nome', 'Nome/Razão Social', 'left');
     $contribuinte_tipo = new TDataGridColumn('contribuinte_tipo', 'Tipo', 'left');
     $contribuinte_tipo = new TDataGridColumn('contribuinte_tipos', 'Tipo', 'left');
     $this->datagrid->addColumn($contribuinte_id);
     $this->datagrid->addColumn($contribuinte_nome);
     $this->datagrid->addColumn($contribuinte_tipo);
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'contribuinte_id');
     $contribuinte_id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'contribuinte_nome');
     $contribuinte_nome->setAction($order_name);
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('contribuinte_id');
     $contribuinte_nome->setEditAction($name_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('ContribuinteForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('contribuinte_id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('contribuinte_id');
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->createModel();
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Publisher');
     // defines the filter field
     parent::setFilterField('name');
     // creates the form
     $this->form = new TForm('form_search_Publisher');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Publishers')), '')->class = 'tformtitle';
     // create the form fields
     $filter = new TEntry('name');
     $filter->setValue(TSession::getValue('Publisher_name'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('PublisherForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('id', 'id', 'right', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('name', 'name', 'left', 440, new TAction(array($this, 'onReload')), array('order', 'name'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('PublisherForm', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     $frame_groups = new TFrame(NULL, 280);
     $frame_groups->setLegend('Grupos');
     $frame_groups->style .= ';margin: 4px';
     $frame_programs = new TFrame(NULL, 280);
     $frame_programs->setLegend('Programas');
     $frame_programs->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200);
     $login->setSize(150);
     $password->setSize(150);
     $email->setSize(200);
     $frontpage_id->setSize(100);
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation('Nome', new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', 'Nome', $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name);
     $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email);
     $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword);
     $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name);
     $row = $table->addRow();
     $cell = $row->addCell($frame_groups);
     $cell->colspan = 2;
     $row = $table->addRow();
     $cell = $row->addCell($frame_programs);
     $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('SystemUserList', 'onReload')), 'Voltar para listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }