コード例 #1
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Usuario');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('login');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Usuario');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('login');
     $filter->setValue(TSession::getValue('Usuario_login'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('login:'******'find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New'));
     $find_button->setImage('ico_find.png');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // 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
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200);
     $senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create 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 = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
コード例 #2
0
 /**
  * Constructor Method
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates a new form
     $this->form = new TForm('form_standard_seek');
     // creates a new table
     $table = new TTable();
     // adds the table into the form
     $this->form->add($table);
     // create the form fields
     $display_field = new TEntry('display_field');
     // keeps the field's value
     $display_field->setValue(TSession::getValue('tstandardseek_display_value'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('Field:'));
     $row->addCell($display_field);
     // create the action button
     $find_button = new TButton('busca');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search'));
     $find_button->setImage('ico_find.png');
     // add a row for the button in the table
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($display_field, $find_button));
     // creates a new datagrid
     $this->datagrid = new TDataGrid();
     // create two datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 70);
     $display = new TDataGridColumn('display_field', 'Field', 'left', 220);
     // add the columns to the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($display);
     // create a datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the paginator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the container
     $vbox = new TVBox();
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the container to the page
     parent::add($vbox);
 }
コード例 #3
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Pedidos');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('id');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Pedidos');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('id');
     $filter->setValue(TSession::getValue('Pedidos_id'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('id:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     // add a row for the form actions
     $table->addRowSet($find_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $dataP = $this->datagrid->addQuickColumn('dataP', 'dataP', 'left', 100);
     $clientes_id = $this->datagrid->addQuickColumn('cliente', 'clientes->nome', 'right', 100);
     $status = $this->datagrid->addQuickColumn('status', 'status', 'right', 100);
     // create the datagrid actions
     $itens_action = new TDataGridAction(array($this, 'showItens'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction("Produtos", $itens_action, 'id', 'ico_find.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create 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 = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
コード例 #4
0
 /**
  * Open an input dialog
  */
 public function onInputDialog($param)
 {
     $name = new TEntry('name');
     $amount = new TEntry('amount');
     $name->setValue($param['key']);
     $form = new TForm('input_form');
     $form->style = 'padding:20px';
     $table = new TTable();
     $table->addRowSet(new TLabel('Name: '), $name);
     $table->addRowSet($lbl = new TLabel('Amount: '), $amount);
     $lbl->setFontColor('red');
     $form->setFields(array($name, $amount));
     $form->add($table);
     // show the input dialog
     new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm');
 }
コード例 #5
0
 /**
  * 
  */
 public function makeTEntry($properties)
 {
     $widget = new TEntry((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setMask((string) $properties->{'mask'});
     $widget->setSize((int) $properties->{'width'});
     if (isset($properties->{'maxlen'})) {
         $widget->setMaxLength((int) $properties->{'maxlen'});
     }
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     if (isset($properties->{'required'}) and $properties->{'required'} == '1') {
         $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator());
     }
     $widget->setEditable((string) $properties->{'editable'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
コード例 #6
0
 /**
 * Metodo para alterar a quantidade do item 
 */
 public function updateItem($param)
 {
     // pega o item a ser alterado
     $produtos = $this->cart->getIten($param['key']);
     try {
         TTransaction::open('sample');
         $produto_old = new Produtos($param['key']);
         // pega o item antigo ara podermos usar a imagem do banco
         /**
         * nessa parte usamos os get da class PProduto para 
         mostrar os dados, lembrando que todo produto inserido no carinho 
         é do tipo PProduto da PWD */
         $row = $this->table->addRow();
         $row->addCell(new PLabel($produtos->getNome(), 'primary'))->colspan = 2;
         $row = $this->table->addRow();
         $row->addCell(new TImage('uploads/' . $produto_old->imagem));
         $row->addCell($produtos->getDescricao());
         $row = $this->table->addRow();
         $row->addCell(new PLabel('R$ ' . $produtos->getPreco(), 'success'));
         $row = $this->table->addRow();
         $row->addCell('Qtd');
         $qtd = new TEntry('qtd');
         $qtd->setValue($produtos->getQtd());
         $row->addCell($qtd);
         $row = $this->table->addRow();
         $btn = new PButton('add', 'success');
         $btn->setLabel('Update');
         $action = new TAction(array($this, 'addItem'));
         $action->setParameter('id', $param['key']);
         $action->setParameters(array('id' => $param['key'], 'qtd' => $qtd->getValue()));
         $btn->setAction($action, 'add+');
         $row->addCell($btn);
         $this->form->setFields(array($btn, $qtd));
         // inserimos os campos no form
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('info', $e->getMessage());
     }
 }
コード例 #7
0
ファイル: CalendarView.class.php プロジェクト: kiibe/linkERP
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the calendar
     $this->calendar = new TCalendar();
     // Gett actual data
     $this->calendar->setMonth(date('m'));
     $this->calendar->setYear(date('Y'));
     $this->calendar->selectDays(date("j"));
     $this->calendar->setSize(750, 500);
     $this->calendar->setAction(new TAction(array($this, 'onSelect')));
     // creates a simple form
     $this->form = new TQuickForm('calendar_helper');
     // creates the notebook around the form
     $notebook = new TNotebook(300, 180);
     $notebook->appendPage('Calendar Helper', $this->form);
     // creates the form fields
     $year = new TEntry('year');
     $month = new TEntry('month');
     $day = new TEntry('day');
     $year->setValue($this->calendar->getYear());
     $month->setValue($this->calendar->getMonth());
     $day->setValue($this->calendar->getSelectedDays());
     $this->form->addQuickField('Year', $year, 100);
     $this->form->addQuickField('Month', $month, 100);
     //$this->form->addQuickField('Day',   $day,   100);
     // creates a table to wrap the treeview and the form
     $table = new TTable();
     $this->form->addQuickAction('Back', new TAction(array($this, 'onBack')), 'ico_back.png');
     $this->form->addQuickAction('Next', new TAction(array($this, 'onNext')), 'ico_next.png');
     $row = $table->addRow();
     $cell = $row->addCell($this->calendar)->valign = 'top';
     $cell = $row->addCell($notebook)->valign = 'top';
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
コード例 #8
0
 /**
  * Class constructor
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(600, 400);
     parent::setTitle('Search record');
     new TSession();
     // creates the form
     $this->form = new TQuickForm('form_search_city');
     // create the form fields
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('city_name'));
     // add the form fields
     $this->form->addQuickField('name', $name, 200);
     // define the form action
     $this->form->addQuickAction('Find', new TAction(array($this, 'onSearch')), 'ico_find.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(230);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('Id', 'id', 'right', 40);
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 340);
     // creates two datagrid actions
     $this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'id', 'ico_apply.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 table
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
コード例 #9
0
 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);
 }
コード例 #10
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 410);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TEntry('field5');
     $field6 = new TPassword('field6');
     $field7 = new TDate('field7');
     $field8 = new TSpinner('field8');
     $field9 = new TSlider('field9');
     $field10 = new TText('field10');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field10->setTip('Tip for field 10');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin'));
     $field7->setSize(100);
     $field8->setRange(0, 100, 10);
     $field9->setRange(0, 100, 10);
     $field8->setValue(30);
     $field9->setValue(50);
     $field10->setSize(300, 80);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry object:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry not editable:'));
     $cell = $row->addCell($field2);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with mask:'));
     $cell = $row->addCell($field3);
     $cell = $row->addCell(new TLabel('99.999-999'));
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with maxlength (10):'));
     $cell = $row->addCell($field4);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with completion (a..):'));
     $cell = $row->addCell($field5);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TPassword object:'));
     $cell = $row->addCell($field6);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TDate Object:'));
     $cell = $row->addCell($field7);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Spinner Object:'));
     $cell = $row->addCell($field8);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Slider Object:'));
     $cell = $row->addCell($field9);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TText Object:'));
     $cell = $row->addCell($field10);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // add the form inside the page
     parent::add($notebook);
 }
コード例 #11
0
 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);
 }
コード例 #12
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     $table = new TTable();
     $notebook = new TNotebook(500, 320);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Registro CRM', $table);
     // create the form fields
     $code = new TEntry('id');
     $crm_id = new TCombo('crm_id');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // finaliza a transacao
     TTransaction::close();
     $items1 = array();
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
     $repository = new TRepository('CRM');
     $cadastros = $repository->load($criteria);
     //adiciona os objetos no combo
     foreach ($cadastros as $object) {
         $items1[$object->id] = $object->titulo;
     }
     // adiciona as opcoes na combo
     $crm_id->addItems($items1);
     TTransaction::close();
     // add field validators
     $registro->addValidation('Registro deve ser informado', new TRequiredValidator());
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     //        $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     $temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     $dataregistro->setSize(90);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button
     $button2 = new TButton('action3');
     $action2 = new TAction(array('ClienteRegistroDetalhe', 'onEdit'));
     //parametro fk e key da sessao
     $action2->setParameter('fk', TSession::getValue('cliente_fk'));
     $action2->setParameter('key', TSession::getValue('crm_key'));
     $button2->setImage('ico_datagrid.png');
     $button2->setAction($action2, 'Voltar');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     // add the form inside the page
     parent::add($table_layout);
 }
コード例 #13
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 340);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TPassword('field5');
     $field6 = new TDate('field6');
     $field7 = new TSpinner('field7');
     $field8 = new TSlider('field8');
     $field9 = new TText('field9');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field6->setSize(100);
     $field7->setRange(0, 100, 10);
     $field8->setRange(0, 100, 10);
     $field7->setValue(30);
     $field8->setValue(50);
     $field9->setSize(300, 50);
     // add rows for the fields
     $table->addRowSet(new TLabel('TEntry object:'), $field1);
     $table->addRowSet(new TLabel('TEntry not editable:'), $field2);
     $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999'));
     $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4);
     $table->addRowSet(new TLabel('TPassword object:'), $field5);
     $table->addRowSet(new TLabel('TDate Object:'), $field6);
     $table->addRowSet(new TLabel('Spinner Object:'), $field7);
     $table->addRowSet(new TLabel('Slider Object:'), $field8);
     $table->addRowSet(new TLabel('TText Object:'), $field9);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook);
     parent::add($vbox);
 }
コード例 #14
0
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     parent::setTitle('Busca de Pessoas');
     parent::setSize(800, 600);
     new TSession();
     // creates the form
     $this->form = new TForm('form_city_Pessoa');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('pessoa_nome');
     // keep the session value
     $name->setValue(TSession::getValue('test_pessoa_name'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel('Nome:'));
     $row->addCell($name);
     // create a find button
     $find_button = new TButton('search');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
     $find_button->setImage('ico_find.png');
     // add a row for the find button
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('pessoa_codigo', 'Id', 'right', 25);
     $name = new TDataGridColumn('pessoa_nome', 'Nome', 'left', 250);
     $origem = new TDataGridColumn('origem_nome', 'Origem', 'left', 330);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'pessoa_codigo');
     $order2->setParameter('order', 'pessoa_nome');
     // define the column actions
     $id->setAction($order1);
     $name->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($origem);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('fa:check-circle-o green');
     $action1->setField('pessoa_codigo');
     // add the action to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create a table for layout
     $table = new TTable();
     // create a row for the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // create a row for the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // create a row for the page navigator
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     $table->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     // add the table inside the page
     parent::add($table);
 }
コード例 #15
0
 /**
  * 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);
 }
コード例 #16
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_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);
 }
コード例 #17
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_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);
 }
コード例 #18
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_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);
 }
コード例 #19
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);
 }
コード例 #20
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Ponto');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Ponto');
     // define the form title
     $this->string = new StringsUtil();
     // create the form fields
     $id = new THidden('id');
     $data_ponto = new TDate('data_ponto');
     $data_ponto->setMask('dd/mm/yyyy');
     $change_data_action = new TAction(array($this, 'onChangeDataAction'));
     $data_ponto->setExitAction($change_data_action);
     $hora_entrada = new THidden('hora_entrada');
     $hora_saida = new THidden('hora_saida');
     $qtde_horas = new TCombo('qtde_horas');
     $qtde_minutos = new TCombo('qtde_minutos');
     $qtde_horas_final = new TCombo('qtde_horas_final');
     $qtde_minutos_final = new TCombo('qtde_minutos_final');
     $colaborador_id = new THidden('colaborador_id');
     TTransaction::open('atividade');
     $logado = Pessoa::retornaUsuario();
     $saldo_mes = Ponto::saldoHorasMes($logado->pessoa_codigo);
     TTransaction::close();
     $colaborador_id->setValue($logado->pessoa_codigo);
     $colaborador_nome = new TEntry('colaborador_nome');
     $colaborador_nome->setEditable(FALSE);
     $colaborador_nome->setValue($logado->pessoa_nome);
     $saldo_horas = new TEntry('saldo_horas');
     $saldo_horas->setEditable(FALSE);
     $saldo_horas->setValue($saldo_mes);
     // cria combos de horas e minutos
     $combo_horas = array();
     $combo_horas_final = array();
     for ($i = 8; $i <= 18; $i++) {
         $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
         $combo_horas_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $combo_horas_final[19] = '19';
     $qtde_horas->addItems($combo_horas);
     $qtde_horas->setValue(8);
     $qtde_horas->setSize(60);
     $qtde_horas->setDefaultOption(FALSE);
     $qtde_horas_final->addItems($combo_horas_final);
     $qtde_horas_final->setSize(60);
     $combo_minutos = array();
     $combo_minutos_final = array();
     for ($i = 0; $i <= 59; $i++) {
         $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
         $combo_minutos_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_minutos->addItems($combo_minutos);
     $qtde_minutos->setValue(0);
     $qtde_minutos->setSize(60);
     $qtde_minutos->setDefaultOption(FALSE);
     $qtde_minutos_final->addItems($combo_minutos_final);
     $qtde_minutos_final->setSize(60);
     // validations
     $data_ponto->addValidation('Data', new TRequiredValidator());
     // add the fields
     $this->form->addQuickField('Colaborador', $colaborador_nome, 200);
     $this->form->addQuickField('Data', $data_ponto, 100);
     $this->form->addQuickFields('Hora entrada', array($qtde_horas, $qtde_minutos));
     $this->form->addQuickFields('Hora saida', array($qtde_horas_final, $qtde_minutos_final));
     $this->form->addQuickField('Saldo no mês:', $saldo_horas, 125);
     $this->form->addQuickField('% Produtividade', new TLabel('<span style="background-color: #00B4FF;"><b>> 49% satisfatoria&nbsp;&nbsp;</b></span><br/><span style="background-color: #FFF800;"><b>30%-49% - Atenção</b></span><br/><span style="background-color: #FF0000;"><b>0-29% Baixa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span>'), 200);
     $this->form->addQuickField('', $hora_entrada, 200);
     $this->form->addQuickField('', $hora_saida, 200);
     $this->form->addQuickField('', $colaborador_id, 100);
     $this->form->addQuickField('', $id, 100);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'fa:floppy-o');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green');
     $this->form->addQuickAction('Excluir', new TAction(array($this, 'onDelete')), 'fa:trash-o red fa-lg');
     TButton::disableField('form_Ponto', 'salvar');
     TButton::disableField('form_Ponto', 'excluir');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $data_ponto = $this->datagrid->addQuickColumn('Data', 'data_ponto', 'left', 50);
     $hora_entrada = $this->datagrid->addQuickColumn('H.Ent', 'hora_entrada', 'left', 30);
     $hora_saida = $this->datagrid->addQuickColumn('H.Sai', 'hora_saida', 'left', 30);
     $hora_ponto = $this->datagrid->addQuickColumn('H.Pto', 'hora_ponto', 'left', 30);
     $intervalo = $this->datagrid->addQuickColumn('Atividades', 'intervalo', 'right', 30);
     $produtividade = $this->datagrid->addQuickColumn('% prod.', 'produtividade', 'right', 55);
     // transformers
     $hora_entrada->setTransformer(array($this, 'tiraSegundos'));
     $hora_saida->setTransformer(array($this, 'tiraSegundos'));
     $hora_ponto->setTransformer(array($this, 'calculaDiferenca'));
     $intervalo->setTransformer(array($this, 'retornaIntervalo'));
     $produtividade->setTransformer(array($this, 'calculaPercentualProdutividade'));
     // create the datagrid actions
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'fa:pencil-square-o blue fa-lg');
     // 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 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);
     parent::add($container);
 }
コード例 #21
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_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);
 }
コード例 #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'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_search_Book');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Books')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $title = new TEntry('title');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description');
     $title->setValue(TSession::getValue('Book_title'));
     $author_id->setValue(TSession::getValue('Book_author_id'));
     $author_name->setValue(TSession::getValue('Book_author_name'));
     $collection_id->setValue(TSession::getValue('Book_collection_id'));
     $classification_id->setValue(TSession::getValue('Book_classification_id'));
     $author_name->setEditable(FALSE);
     $title->setSize(320);
     $author_id->setSize(100);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_search_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($title);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addMultiCell($author_id, $author_name);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $cell = $row->addCell($collection_id);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Classification') . ': '));
     $cell = $row->addCell($classification_id);
     // 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('BookForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $table->addRowSet('', array($find_button, $new_button))->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($title, $author_id, $author_name, $collection_id, $classification_id, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(280);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', _t('Code'), 'right', 50);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 200);
     $main_author = new TDataGridColumn('author_name', _t('Author'), 'left', 160);
     $edition = new TDataGridColumn('edition', _t('Edition'), 'left', 50);
     $call = new TDataGridColumn('call_number', _t('Call'), 'left', 80);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'title');
     // assign the ordering actions
     $id->setAction($order1);
     $title->setAction($order2);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($title);
     $this->datagrid->addColumn($main_author);
     $this->datagrid->addColumn($edition);
     $this->datagrid->addColumn($call);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('BookForm', '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 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);
 }
コード例 #23
0
ファイル: ItemSeek.class.php プロジェクト: jhonleandres/crmbf
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_item_Seek');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $barcode = new TEntry('barcode');
     // keep the session value
     $barcode->setValue(TSession::getValue('test_item_barcode'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Barcode')));
     $row->addCell($barcode);
     // create a find button
     $find_button = new TButton('search');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
     $find_button->setImage('ico_find.png');
     // add a row for the find button
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($barcode, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('id', _t('Code'), 'right', 70);
     $barcode = new TDataGridColumn('barcode', _t('Barcode'), 'left', 100);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 200);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'barcode');
     // define the column actions
     $id->setAction($order1);
     $barcode->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($barcode);
     $this->datagrid->addColumn($title);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('barcode');
     // add the action to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create a table for layout
     $table = new TTable();
     // create a row for the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // create a row for the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // create a row for the page navigator
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
コード例 #24
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'));
     }
     // 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);
 }
コード例 #25
0
 /**
  * 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);
 }
コード例 #26
0
 /**
  * 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_customer');
     // create the form fields
     $name = new TEntry('name');
     $city_name = new TEntry('city_name');
     $name->setSize(170);
     $city_name->setSize(126);
     $name->setValue(TSession::getValue('customer_name'));
     $city_name->setValue(TSession::getValue('customer_city_name'));
     $table = new TTable();
     $row = $table->addRow();
     $cell = $row->addCell('');
     $cell->width = 80;
     $row->addCell($name);
     $cell = $row->addCell('');
     $row->addCell($city_name);
     $this->form->add($table);
     // creates the action button
     $button1 = new TButton('find');
     $button1->setAction(new TAction(array($this, 'onSearch')), 'Find');
     $button1->setImage('ico_find.png');
     $button2 = new TButton('new');
     $button2->setAction(new TAction(array('CustomerFormView', 'onEdit')), 'New');
     $button2->setImage('ico_new.png');
     $button3 = new TButton('csv');
     $button3->setAction(new TAction(array($this, 'onExportCSV')), 'CSV');
     $button3->setImage('ico_print.png');
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $this->form->setFields(array($name, $city_name, $button1, $button2, $button3));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(200);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('Id', 'id', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 170, new TAction(array($this, 'onReload')), array('order', 'name'));
     $this->datagrid->addQuickColumn('City', 'city->name', 'left', 140, new TAction(array($this, 'onReload')), array('order', 'city->name'));
     $this->datagrid->addQuickColumn('Address', 'address', 'left', 190);
     // creates two datagrid actions
     $this->datagrid->addQuickAction('Edit', new TDataGridAction(array('CustomerFormView', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction('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 vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the box inside the page
     parent::add($vbox);
 }
コード例 #27
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);
 }
コード例 #28
0
ファイル: UserList.class.php プロジェクト: jhonleandres/crmbf
 /**
  * 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 !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('User');
     // defines the filter field
     parent::setFilterField('Login');
     // creates the form
     $this->form = new TForm('form_search_User');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('login');
     $filter->setValue(TSession::getValue('User_login'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('login:'******'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('UserForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $row = $table->addRow();
     $row->addCell($find_button);
     $row->addCell($new_button);
     // 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('login', 'login', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'login'));
     $this->datagrid->addQuickColumn('name', 'name', 'left', 300, new TAction(array($this, 'onReload')), array('order', 'name'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('UserForm', '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 table
     $table = new TTable();
     // add a row to the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // add a row to the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // add a row for page navigation
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
コード例 #29
0
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(TSession::getValue('width'), TSession::getValue('height'));
     parent::setTitle(TSession::getValue('titulo'));
     new TSession();
     // creates the form
     $this->form = new TForm('formSeekStandart');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     // keep the session value
     $name->setValue(TSession::getValue('name'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel($this->getFiltro() . ' :'));
     $row->addCell($name);
     // create a find button
     $find_button = new TButton('search');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
     $find_button->setImage('ico_find.png');
     // add a row for the find button
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     $i = 1;
     // create the datagrid columns
     if (TSession::getValue('campos')) {
         foreach (TSession::getValue('campos') as $field => $label) {
             $campos[] = new TDataGridColumn($field, $label, 'right', 200);
         }
         foreach ($campos as $campo) {
             // add the columns inside the datagrid
             $this->datagrid->addColumn($campo);
         }
     }
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField(TSession::getValue('key'));
     // add the action to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create a table for layout
     $table = new TTable();
     // create a row for the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // create a row for the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // create a row for the page navigator
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
コード例 #30
-1
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // defines the database
     parent::setDatabase('samples');
     // defines the active record
     parent::setActiveRecord('Project');
     // defines the filter field
     parent::setFilterField('name');
     // creates the form
     $this->form = new TForm('form_search_Project');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('name');
     $filter->setValue(TSession::getValue('Project_name'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('name:'), $filter);
     // create two action buttons to the form
     $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('ProjectFormView', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // 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
     $id = $this->datagrid->addQuickColumn('ID', 'id', 'left', 50);
     $name = $this->datagrid->addQuickColumn('Name', 'name', 'left', 190);
     $start = $this->datagrid->addQuickColumn('Start', 'start_date', 'left', 80);
     $end = $this->datagrid->addQuickColumn('End', 'end_date', 'left', 80);
     $customer = $this->datagrid->addQuickColumn('customer', 'customer', 'left', 100);
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('ProjectFormView', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     $this->datagrid->addQuickAction(_t('Detail'), new TDataGridAction(array('BacklogFormView', 'onSetProject')), 'id');
     // 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());
     // pack the elements using a vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the box inside the page
     parent::add($vbox);
 }