public function __construct() { parent::__construct(); // creates one datagrid $this->datagrid = new TDataGrid(); // create the datagrid columns $code = new TDataGridColumn('code', 'Code', 'left', 50); $name = new TDataGridColumn('name', 'Name', 'left', 180); $address = new TDataGridColumn('address', 'Address', 'left', 140); $telephone = new TDataGridColumn('fone', 'Phone', 'center', 100); // add the columns to the datagrid $this->datagrid->addColumn($code); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); $this->datagrid->addColumn($telephone); $action1 = new TAction(array($this, 'onColumnAction')); $action1->setParameter('column', 'code'); $code->setAction($action1); $action2 = new TAction(array($this, 'onColumnAction')); $action2->setParameter('column', 'name'); $name->setAction($action2); // creates the datagrid model $this->datagrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->datagrid); parent::add($vbox); }
public function __construct() { parent::__construct(); $this->form = new TForm(); // creates one datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->disableDefaultClick(); $this->form->add($this->datagrid); // creates the action button $button1 = new TButton('action1'); // define the button action $action_button1 = new TAction(array($this, 'onUpdate')); $action_button1->setParameter('id', filter_input(INPUT_GET, 'id')); $button1->setAction($action_button1, 'Atualizar'); $button1->setImage('fa:check-circle-o green'); $this->form->addField($button1); // add the columns $this->datagrid->addQuickColumn('Tipo de Atividade', 'nome', 'left', 180); $this->datagrid->addQuickColumn('Ticket', 'ticket', 'left', 180); $this->datagrid->addQuickColumn('Sistema', 'sistema', 'left', 180); // creates the datagrid model $this->datagrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add($button1); $vbox->add($this->form); parent::add($vbox); }
public function __construct() { parent::__construct(); // instancia objeto DataGrid $this->datagrid = new TDataGrid(); // instancia as colunas da DataGrid $codigo = new TDataGridColumn('id', 'Código', 'right', 50); $nome = new TDataGridColumn('nome', 'Nome', 'left', 180); $endereco = new TDataGridColumn('endereco', 'Endereço', 'left', 140); $qualifica = new TDataGridColumn('qualifica', 'Qualificações', 'left', 200); $action1 = new TAction(array($this, 'onReload')); $action1->setParameter('order', 'id'); $action2 = new TAction(array($this, 'onReload')); $action2->setParameter('order', 'nome'); $codigo->setAction($action1); $nome->setAction($action2); // adiciona as colunas à DataGrid $this->datagrid->addColumn($codigo); $this->datagrid->addColumn($nome); $this->datagrid->addColumn($endereco); $this->datagrid->addColumn($qualifica); // cria o modelo da DataGrid, montando sua estrutura $this->datagrid->createModel(); // adiciona a DataGrid à página parent::add($this->datagrid); }
public function __construct() { parent::__construct(); // create two actions $action1 = new TAction(array($this, 'onAction1')); $action2 = new TAction(array($this, 'onAction2')); // define os parâmetros de cada ação $action1->setParameter('parameter', 1); $action2->setParameter('parameter', 2); // shows the question dialog new TQuestion('Do you really want to perform this operation ?', $action1, $action2); parent::add(new TXMLBreadCrumb('menu.xml', __CLASS__)); }
/** * Add a column * @param $label Field Label * @param $object Field Object * @param $size Field Size */ public function addQuickColumn($label, $name, $align = 'left', $size = 200, TAction $action = NULL, $param = NULL) { // creates a new column $object = new TDataGridColumn($name, $label, $align, $size); if ($action instanceof TAction) { // create ordering $action->setParameter($param[0], $param[1]); $object->setAction($action); } // add the column to the datagrid parent::addColumn($object); return $object; }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); new TSession(); // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(280); // creates the datagrid columns $id = new TDataGridColumn('id', 'id', 'right', 40); $name = new TDataGridColumn('name', 'Name', 'left', 200); $address = new TDataGridColumn('address', 'Address', 'left', 200); // 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', 'name'); // assign the ordering actions $id->setAction($order1); $name->setAction($order2); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($address); // creates a datagrid action $action1 = new TDataGridAction(array('CustomerFormView', 'onEdit')); $action1->setLabel('Edit'); $action1->setImage('ico_edit.png'); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // creates the edit action $editaction = new TDataGridAction(array($this, 'onEdit')); $editaction->setField('id'); $name->setEditAction($editaction); // 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 $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); // add the table inside the page parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Pessoa'); // defines the active record // creates the form $this->form = new TQuickForm('form_Pessoa'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // define the form title $this->form->setFormTitle('Pessoa'); // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $telefone = new TEntry('telefone'); $email = new TEntry('email'); $endereco = new TEntry('endereco'); $numero = new TEntry('numero'); $cidade_id = new TSeekButton('cidade_id'); $cidade_id->addValidation('Cidade', new TRequiredValidator()); $cidade_name = new TEntry('cidade_name'); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'esales'); $action->setParameter('parent', 'form_Pessoa'); $action->setParameter('model', 'Cidade'); $action->setParameter('display_field', 'descricao'); $action->setParameter('receive_key', 'cidade_id'); $action->setParameter('receive_field', 'cidade_name'); $cidade_id->setAction($action); $cep = new TEntry('cep'); $cpf_cnpj = new TEntry('cpf_cnpj'); $tipo_pessoa = new TRadioGroup('tipo_pessoa'); $tipo_pessoa->addItems(array('F' => 'Fisica', 'J' => 'Juridica')); // add the fields $this->form->addQuickField('Codigo', $id, 100); $this->form->addQuickField('Nome', $nome, 200); $this->form->addQuickField('Telefone', $telefone, 200); $this->form->addQuickField('Email', $email, 200); $this->form->addQuickField('Endereço', $endereco, 200); $this->form->addQuickField('Numero', $numero, 200); $this->form->addQuickFields('Cidade', array($cidade_id, $cidade_name), true); $this->form->addQuickField('CEP', $cep, 200); $this->form->addQuickField('CPF/CNPJ', $cpf_cnpj, 100); $this->form->addQuickField('Tipo de pessoa', $tipo_pessoa, 200); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png'); // add the form to the page parent::add($this->form); }
/** * Class Constructor * @param $name name of the form field * @param $database name of the database connection * @param $form name of the parent form * @param $model name of the Active Record to be searched * @param $display_field name of the field to be searched and shown * @param $receive_key name of the form field to receive the primary key * @param $receive_display_field name of the form field to receive the "display field" */ public function __construct($name, $database, $form, $model, $display_field, $receive_key, $receive_display_field) { parent::__construct($name); $obj = new TStandardSeek(); // define the action parameters $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', $database); $action->setParameter('parent', $form); $action->setParameter('model', $model); $action->setParameter('display_field', $display_field); $action->setParameter('receive_key', $receive_key); $action->setParameter('receive_field', $receive_display_field); parent::setAction($action); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); parent::setDatabase('esales'); // defines the database parent::setActiveRecord('Produto'); // defines the active record // creates the form $this->form = new TQuickForm('form_Produto'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // define the form title $this->form->setFormTitle('Produto'); // create the form fields $id = new TEntry('id'); $descricao = new TEntry('descricao'); $preco_compra = new TEntry('preco_compra'); $preco_venda = new TEntry('preco_venda'); $marca_id = new TEntry('marca_id'); $marca_id = new TSeekButton('marca_id'); $marca_name = new TEntry('marca_name'); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'esales'); $action->setParameter('parent', 'form_Produto'); $action->setParameter('model', 'Marca'); $action->setParameter('display_field', 'descricao'); $action->setParameter('receive_key', 'marca_id'); $action->setParameter('receive_field', 'marca_name'); $marca_id->setAction($action); // add the fields $this->form->addQuickField('Codigo', $id, 100); $this->form->addQuickField('Descricao', $descricao, 200); $this->form->addQuickField('Preco compra', $preco_compra, 200); $this->form->addQuickField('Preco venda', $preco_venda, 200); $this->form->addQuickFields('Marca', array($marca_id, $marca_name)); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png'); // add the form to the page parent::add($this->form); }
/** * Show the widget */ public function show() { // check if it's not editable if (parent::getEditable()) { $serialized_action = ''; if ($this->action) { // get the action class name if (is_array($callback = $this->action->getAction())) { $classname = get_class($callback[0]); $inst = new $classname(); $ajaxAction = new TAction(array($inst, 'onSelect')); if ($classname == 'TStandardSeek') { $ajaxAction->setParameter('parent', $this->action->getParameter('parent')); $ajaxAction->setParameter('database', $this->action->getParameter('database')); $ajaxAction->setParameter('model', $this->action->getParameter('model')); $ajaxAction->setParameter('display_field', $this->action->getParameter('display_field')); $ajaxAction->setParameter('receive_key', $this->action->getParameter('receive_key')); $ajaxAction->setParameter('receive_field', $this->action->getParameter('receive_field')); } $string_action = $ajaxAction->serialize(FALSE); if ($this->useOutEvent) { $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, this)"); } } $serialized_action = $this->action->serialize(FALSE); } parent::show(); $image = new TImage('lib/adianti/images/ico_find.png'); $link = new TElement('a'); $link->onmouseover = 'style.cursor = \'pointer\''; $link->onmouseout = 'style.cursor = \'default\''; $link->onclick = "javascript:serialform=(\$('#{$this->formName}').serialize());\n __adianti_append_page('engine.php?{$serialized_action}&'+serialform)"; $link->add($image); $link->show(); if ($this->auxiliar) { echo ' '; $this->auxiliar->show(); } } else { parent::show(); } }
/** * method onDelete() * executed whenever the user clicks at the delete button * Ask if the user really wants to delete the record */ function onDelete($param) { // get the parameter $key $key = $param['key']; // define two actions $action = new TAction(array($this, 'Delete')); // define the action parameters $action->setParameter('key', $key); // shows a dialog to the user new TQuestion(TAdiantiCoreTranslator::translate('Do you really want to delete ?'), $action); }
/** * Recarrega tela */ public function onReload($param) { $dados = TSession::getValue('person_dados'); $this->lista->clear(); if ($dados) { foreach ($dados as $dado) { $item_name = 'check_' . $dado[0]; $item = new StdClass(); $action_del = new TAction(array($this, 'onDeleteItem')); $action_del->setParameter('item', $dado[0]); $action_edi = new TAction(array($this, 'onEditItem')); $action_edi->setParameter('item', $dado[0]); $button_del = new TButton('delete_' . $dado[0]); $button_del->class = 'btn btn-default btn-sm'; $button_del->setAction($action_del, ''); $button_del->setImage('fa:trash-o'); $button_edi = new TButton('edit_' . $dado[0]); $button_edi->class = 'btn btn-default btn-sm'; $button_edi->setAction($action_edi, ''); $button_edi->setImage('fa:edit'); $item->edit = $button_edi; $item->delete = $button_del; $this->formFields[$item_name . '_edit'] = $item->edit; $this->formFields[$item_name . '_delete'] = $item->delete; $item->code = $dado[0]; $item->description = $dado[1]; $item->value = $dado[2]; $this->lista->addItem($item); } $this->form->setFields($this->formFields); } $this->loaded = TRUE; }
/** * 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_listar_crm_clientes'); $key = $_GET['key']; // create the form fields $name = new TEntry('nome'); $name->setSize(170); $table = new TTable(); $row = $table->addRow(); $cell = $row->addCell(''); $cell->width = PHP_SAPI == 'cli' ? 40 : 80; $row->addCell($name); $this->form->add($table); // creates the action button $button1 = new TButton('find'); $button1->setAction(new TAction(array($this, 'onSearch')), 'Buscar'); $button1->setImage('ico_find.png'); // create an action button $button2 = new TButton('novo'); $action2 = new TAction(array('CRMForm', 'onEdit')); $action2->setParameter('key', $key); $button2->setImage('ico_new.png'); $button2->setAction($action2, 'Novo'); $button3 = new TButton('csv'); $button3->setAction(new TAction(array($this, 'onExportCSV')), 'CSV'); $button3->setImage('ico_print.png'); // create an action button $button4 = new TButton('action3'); $action4 = new TAction(array('ClienteList', 'onReload')); // $action3->setParameter('key', $_GET['key']); $action4->setParameter('key', $key); $button4->setImage('ico_previous.png'); $button4->setAction($action4, 'Voltar'); $row->addCell($button1); $row->addCell($button2); $row->addCell($button3); $row->addCell($button4); $this->form->setFields(array($name, $button1, $button2, $button3, $button4)); // creates a DataGrid $this->datagrid = new TDataGrid(); // $this->datagrid->setHeight(200); // create the datagrid columns $dgid = new TDataGridColumn('id', 'Id', 'right', 70); $dgtitulo = new TDataGridColumn('titulo', 'Titulo', 'left', 180); $dgprojeto = new TDataGridColumn('projeto_nome', 'Projeto', 'left', 180); $dgdata = new TDataGridColumn('data_crm', 'Data', 'left', 160); $dgtempo = new TDataGridColumn('tempo', 'Tempo', 'left', 160); $dgdescricao = new TDataGridColumn('descricao', 'Descrição', 'left', 160); $dgsolicitante = new TDataGridColumn('solicitante', 'Solicitante', 'left', 160); $dgresponsavel = new TDataGridColumn('tipo_nome', 'Tipo', 'left', 160); $dgcliente = new TDataGridColumn('cliente_nome', 'Cliente', 'left', 160); $dgnome = new TDataGridColumn('prioridade_nome', 'Prioridade', 'left', 160); $dgstatus = new TDataGridColumn('status_nome', 'Status', 'left', 160); // add the columns to the datagrid $this->datagrid->addColumn($dgid); $this->datagrid->addColumn($dgtitulo); $this->datagrid->addColumn($dgprojeto); $this->datagrid->addColumn($dgdata); $this->datagrid->addColumn($dgtempo); $this->datagrid->addColumn($dgdescricao); $this->datagrid->addColumn($dgsolicitante); $this->datagrid->addColumn($dgresponsavel); $this->datagrid->addColumn($dgcliente); $this->datagrid->addColumn($dgnome); $this->datagrid->addColumn($dgstatus); // creates two datagrid actions $action1 = new TDataGridAction(array('CRMForm', 'onEdit')); $action1->setLabel('Editar'); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel('Delete'); $action2->setImage('ico_delete.png'); $action2->setField('id'); // $obj = ClienteRegistroDetalhe(); $action3 = new TDataGridAction(array('ClienteRegistroDetalhe', 'onEdit')); $action3->setLabel('Registros'); $action3->setImage('ico_custom_form.png'); $action3->setField('id'); $action3->setParameter('fk', $_GET['key']); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); $this->datagrid->addAction($action3); // 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); }
/** * 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); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_SystemProgram'); $this->form->class = 'tform'; // creates a table $table = new TTable(); $table->style = 'width:100%'; $table->addRowSet(new TLabel(_t('Programs')), '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); $name->setValue(TSession::getValue('SystemProgram_name')); $control = new TEntry('controller'); $control->setValue(TSession::getValue('SystemProgram_control')); // add rows for the filter fields $row = $table->addRowSet(new TLabel(_t('Name') . ': '), $name); $row = $table->addRowSet(new TLabel(_t('Controller') . ': '), $control); // create two action buttons to the form $find_button = new TButton('find'); $new_button = new TButton('new'); // define the button actions $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find')); $find_button->setImage('ico_find.png'); $new_button->setAction(new TAction(array('SystemProgramForm', 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); // define wich are the form fields $this->form->setFields(array($name, $control, $find_button, $new_button)); $container = new THBox(); $container->add($find_button); $container->add($new_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($container); $cell->colspan = 2; // creates a DataGrid $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('id', 'ID', 'right'); $name = new TDataGridColumn('name', _t('Name'), 'left'); $controller = new TDataGridColumn('controller', _t('Controller'), 'left'); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($name); $this->datagrid->addColumn($controller); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_name = new TAction(array($this, 'onReload')); $order_name->setParameter('order', 'name'); $name->setAction($order_name); $order_controller = new TAction(array($this, 'onReload')); $order_controller->setParameter('order', 'controller'); $controller->setAction($order_controller); // inline editing $name_edit = new TDataGridAction(array($this, 'onInlineEdit')); $name_edit->setField('id'); $name->setEditAction($name_edit); $controller_edit = new TDataGridAction(array($this, 'onInlineEdit')); $controller_edit->setField('id'); $controller->setEditAction($controller_edit); // creates two datagrid actions $action1 = new TDataGridAction(array('SystemProgramForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('ico_edit.png'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('ico_delete.png'); $action2->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates the page structure using a table $table = new TTable(); $table->style = 'width: 80%'; $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__)); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); $table->addRow()->addCell($this->pageNavigation); // add the table inside the page parent::add($table); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_clienteRegistro_Detalhe'); new TSession(); // creates a table $table = new TTable(); $panel = new TPanel(480, 250); // $panel->style = "background-image: url(app/images/background.png);"; $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); // add the notebook inside the form $this->form->add($table); // envia key e fk para sessao TSession::setValue('crm_key', $_GET['key']); TSession::setValue('cliente_fk', $_GET['fk']); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria = new TCriteria(); $criteria->add(new TFilter('cliente_id', '=', $_GET['fk'])); $repository = new TRepository('CRM'); $CRM = $repository->load($criteria); foreach ($CRM as $crms) { $codigoCRM = $crms->id; $tituloCRM = $crms->titulo; $projetoCRM = $crms->projeto_nome; $dataCRM = $crms->data_crm; $tempoCRM = $crms->tempo; $porcentagemCRM = $crms->porcentagem; $descricaoCRM = $crms->descricao; $solicitanteCRM = $crms->solicitante; $usuarioalteracaoCRM = $crms->usuarioalteracao; $responsavel_nomeCRM = $crms->responsavel_nome; $tipo_nomeCRM = $crms->tipo_nome; $cliente_nomeCRM = $crms->cliente_nome; $prioridade_nomeCRM = $crms->prioridade_nome; $status_nomeCRM = $crms->status_nome; } TTransaction::close(); $titulo = new TLabel('CRM - Registros'); $titulo->setFontSize(14); $titulo->setFontFace('Arial'); $titulo->setFontColor('red'); // add a row for the field code $panel->put($titulo, 10, 5); $panel->put("CRM: " . $codigoCRM, 10, 25); $panel->put("Titulo: " . $tituloCRM, 10, 45); $panel->put("Projeto: " . $projetoCRM, 10, 65); $panel->put("Data de Criação: " . $dataCRM, 10, 85); $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 105); $panel->put("Cliente: " . $cliente_nomeCRM, 10, 125); $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 145); $panel->put("Tipo: " . $tipo_nomeCRM, 10, 165); $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 185); $panel->put("Tempo Gasto: " . $tempoCRM, 10, 205); $panel->put("Situação: " . $status_nomeCRM, 10, 225); //inserir button no panel $panel->put($button1, 10, 325); $panel->put($button2, 100, 325); // create an action button $button1 = new TButton('action1'); $action1 = new TAction(array('CRMClienteList', 'onReload')); $action1->setParameter('key', $_GET['fk']); $button1->setImage('ico_datagrid.png'); $button1->setAction($action1, 'Voltar'); // create an action button $button2 = new TButton('action2'); $action2 = new TAction(array('RegistroForm', 'onEdit')); $action2->setParameter('fk', $_GET['fk']); $button2->setImage('ico_save.png'); $button2->setAction($action2, 'Inserir Registro'); // define wich are the form fields $this->form->setFields(array($button1, $button2)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button2); $row->addCell($button1); $table_layout = new TTable(); $table_layout->addRow()->addCell($subtable); $table_layout->addRow()->addCell($this->form); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria2 = new TCriteria(); // $criteria->add(new TFilter('crm_id', '=', $_GET['key'])); $criteria2->setProperty('order', 'id desc'); $repository2 = new TRepository('Registro'); $reg = $repository2->load($criteria2); foreach ($reg as $regs) { $row = $table->addRow(); $row->addCell(new TLabel('ID:')); $cell = $row->addCell($regs->id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->crm_id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->tiporegistro_id); $row = $table->addRow(); $row->addCell(new TLabel('Tempo:')); $cell = $row->addCell($regs->tempo_registro); $row = $table->addRow(); $row->addCell(new TLabel('Data:')); $cell = $row->addCell($regs->data_registro); $row = $table->addRow(); $row->addCell(new TLabel('Horario:')); $cell = $row->addCell($regs->hora_registro); $row = $table->addRow(); $row->addCell(new TLabel('Numero Registro:')); $cell = $row->addCell($regs->numero_registro); $row = $table->addRow(); $row->addCell(new TLabel('Registro:')); $cell = $row->addCell($regs->registro); $row = $table->addRow(); $row->addCell(new TLabel(' ')); $cell = $row->addCell(' '); } TTransaction::close(); parent::add($panel); parent::add($table_layout); }
/** * method onDelete() * executed whenever the user clicks at the delete button * Ask if the user really wants to delete the record */ function onDelete($param) { // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // get the parameter $key $key = $param['key']; // define two actions $action = new TAction(array($this, 'Delete')); // define the action parameters $action->setParameter('key', $key); // shows a dialog to the user new TQuestion(TAdiantiCoreTranslator::translate('Do you really want to delete ?'), $action); }
/** * 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); }
/** * Show the widget */ public function show() { // check if it's not editable if (parent::getEditable()) { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()')); } $serialized_action = ''; if ($this->action) { // get the action class name if (is_array($callback = $this->action->getAction())) { $classname = is_object($callback[0]) ? get_class($callback[0]) : $callback[0]; $inst = new $classname(); $ajaxAction = new TAction(array($inst, 'onSelect')); if ($classname == 'TStandardSeek') { $ajaxAction->setParameter('parent', $this->action->getParameter('parent')); $ajaxAction->setParameter('database', $this->action->getParameter('database')); $ajaxAction->setParameter('model', $this->action->getParameter('model')); $ajaxAction->setParameter('display_field', $this->action->getParameter('display_field')); $ajaxAction->setParameter('receive_key', $this->action->getParameter('receive_key')); $ajaxAction->setParameter('receive_field', $this->action->getParameter('receive_field')); } $string_action = $ajaxAction->serialize(FALSE); if ($this->useOutEvent) { $this->setProperty('seekaction', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, document.{$this->formName}.{$this->name})"); $this->setProperty('onBlur', $this->getProperty('seekaction'), FALSE); } } $serialized_action = $this->action->serialize(FALSE); } parent::show(); $this->button->onclick = "javascript:serialform=(\$('#{$this->formName}').serialize());\n __adianti_append_page('engine.php?{$serialized_action}&'+serialform)"; $this->button->show(); if ($this->auxiliar) { echo ' '; $this->auxiliar->show(); } } else { parent::show(); } }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_search_RequisitoDesenvolvimento'); $this->form->class = 'tform'; // CSS class // creates a table $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de DRs'))->colspan = 2; // create the form fields $id = new TEntry('ticket_id'); $id->setMask('99999'); $titulo = new TEntry('titulo'); $data_cadastro = new TDate('data_cadastro'); $data_cadastro->setMask('dd/mm/yyyy'); // define the sizes $id->setSize(50); $titulo->setSize(200); $data_cadastro->setSize(100); // add one row for each form field $table->addRowSet(new TLabel('Ticket:'), $id); $table->addRowSet(new TLabel('Título:'), $titulo); $table->addRowSet(new TLabel('Data:'), $data_cadastro); $this->form->setFields(array($id, $titulo, $data_cadastro)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('RequisitoDesenvolvimento_filter_data')); // create two action buttons to the form $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png'); $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png'); $this->form->addField($find_button); $this->form->addField($clean_button); $buttons_box = new THBox(); $buttons_box->add($find_button); $buttons_box->add($clean_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // creates a Datagrid $this->datagrid = new TDataGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = new TDataGridColumn('ticket_id', 'ID', 'right', 20); $data_cadastro = new TDataGridColumn('data_cadastro', 'Data', 'left', 80); $titulo = new TDataGridColumn('titulo', 'Título', 'left', 300); $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'right', 300); $data_cadastro->setTransformer(array('StringsUtil', 'formatDateBR')); // add the columns to the DataGrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($data_cadastro); $this->datagrid->addColumn($titulo); $this->datagrid->addColumn($ticket_id); // creates the datagrid column actions $order_id = new TAction(array($this, 'onReload')); $order_id->setParameter('order', 'id'); $id->setAction($order_id); $order_titulo = new TAction(array($this, 'onReload')); $order_titulo->setParameter('order', 'titulo'); $titulo->setAction($order_titulo); $order_data_cadastro = new TAction(array($this, 'onReload')); $order_data_cadastro->setParameter('order', 'data_cadastro'); $data_cadastro->setAction($order_data_cadastro); $order_ticket_id = new TAction(array($this, 'onReload')); $order_ticket_id->setParameter('order', 'ticket->titulo'); $ticket_id->setAction($order_ticket_id); // creates two datagrid actions $action1 = new TDataGridAction(array('RequisitoDesenvolvimentoForm', 'onEdit')); $action1->setLabel(_t('Edit')); $action1->setImage('fa:pencil-square-o blue fa-lg'); $action1->setField('id'); $action2 = new TDataGridAction(array($this, 'onDelete')); $action2->setLabel(_t('Delete')); $action2->setImage('fa:trash-o red fa-lg'); $action2->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); $this->datagrid->addAction($action2); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); $container->style = 'width: 100%;max-width: 1200px;'; $this->datagrid->style = ' width: 100%; max-width: 1200px;'; parent::add($container); }
/** * Class constructor * Creates the page 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); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_clienteRegistro Detalhe'); // creates a table $table = new TTable(); $panel = new TPanel(480, 260); $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); // add the notebook inside the form $this->form->add($table); // create the form fields $city_id2 = new TSeekButton('city_id2'); $city_name2 = new TEntry('city_name2'); $city_id2->setSize(100); $city_name2->setEditable(FALSE); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria = new TCriteria(); $criteria->add(new TFilter('cliente_id', '=', $_GET['key'])); // $repository = new TRepository('CRM'); $CRM = $repository->load($criteria); foreach ($CRM as $crms) { $codigoCRM = $crms->id; $tituloCRM = $crms->titulo; $projetoCRM = $crms->projeto_nome; $dataCRM = $crms->data_crm; $tempoCRM = $crms->tempo; $porcentagemCRM = $crms->porcentagem; $descricaoCRM = $crms->descricao; $solicitanteCRM = $crms->solicitante; $usuarioalteracaoCRM = $crms->usuarioalteracao; $responsavel_nomeCRM = $crms->responsavel_nome; $tipo_nomeCRM = $crms->tipo_nome; $cliente_nomeCRM = $crms->cliente_nome; $prioridade_nomeCRM = $crms->prioridade_nome; $status_nomeCRM = $crms->status_nome; } TTransaction::close(); $notebook->appendPage('Registros CRMs', $table); $code = new TEntry('id'); $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo'); $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'); // 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->setRange(0,1000,1); $dataregistro->setSize(90); // $hora_registro->setRange(0,100,1); $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); // $notebook->appendPage('Cidade', $table_contact); // $notebook->appendPage('Skill (aggregation)', $table_skill); // create the form fields // $code = new TEntry('id'); // $nome = new TEntry('nome'); // $email = new TEntry('email'); // $telefone = new TEntry('telefone'); // $celular = new TEntry('celular'); // $skype = new TEntry('skype'); // $endereco = new TEntry('endereco'); //// $cidade_id = new TSeekButton('cidade_id'); // $cidade_id = new TDBCombo('cidade_id', 'db_crmbf', 'Cidade', 'id', 'nome'); // $birthdate = new TDate('birthdate'); // $email = new TEntry('email'); // $gender = new TRadioGroup('gender'); // $status = new TCombo('status'); // $contacts_list = new TMultiField('contacts_list'); // add field validators // $nome->addValidation('Nome', new TRequiredValidator); // $cidade_id->addValidation('Cidade', new TRequiredValidator); // $birthdate->addValidation('Birthdate', new TRequiredValidator); // $cidade_id->addValidation('Category', new TRequiredValidator); //$obj = new CidadeFormList; //$cidade_id->setAction(new TAction(array($obj, 'onReload'))); // $itemGender = array(); // $itemGender['M'] = 'Male'; // $itemGender['F'] = 'Female'; // // add the combo options // $gender->addItems($itemGender); // $gender->setLayout('horizontal'); // // $itemStatus = array(); // $itemStatus['S'] = 'Single'; // $itemStatus['C'] = 'Committed'; // $itemStatus['M'] = 'Married'; // $status->addItems($itemStatus); // define some properties for the form fields // $code->setEditable(FALSE); // $code->setSize(100); // $nome->setSize(320); // $email->setSize(160); // $telefone->setSize(160); // $celular->setSize(160); // $skype->setSize(160); // $endereco->setSize(320); // $cidade_id->setSize(150); //$cidade_id->setEditable(FALSE); // add a row for the field code $panel->put("CRM: ", $codigoCRM, 10, 5); $panel->put($tituloCRM, 10, 20); $panel->put($projetoCRM, 10, 40); $panel->put("Data de Criação: " . $dataCRM, 10, 75); $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 95); $panel->put("Cliente: " . $cliente_nomeCRM, 10, 55); $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 110); $panel->put("Tipo: " . $tipo_nomeCRM, 10, 130); $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 140); $panel->put("Tempo Gasto: " . $tempoCRM, 10, 160); $panel->put("Situação: " . $status_nomeCRM, 10, 180); $panel->put("Descrição: " . $descricaoCRM, 10, 200); // $row = $table->addRow(); // $row->addCell(new TLabel('Titulo:')); // $row->addCell($tituloCRM); // // // add a row for the field name // $row = $table->addRow(); // $row->addCell(new TLabel('Projeto:')); // $cell = $row->addCell($projetoCRM); // $cell->colspan = 3; // // // add a row for the field Email // $row = $table->addRow(); // $row->addCell(new TLabel('DATA:')); // $cell = $row->addCell($dataCRM); // $cell->colspan = 3; // // // add a row for the field Telefone // $row = $table->addRow(); // $row->addCell(new TLabel('Tempo:')); // $cell = $row->addCell($tempoCRM); // $cell->colspan = 3; // // // add a row for the field celular // $row = $table->addRow(); // $row->addCell(new TLabel('Porcentagem:')); // $cell = $row->addCell($porcentagemCRM); // // // add a row for the field skype // $row = $table->addRow(); // $row->addCell(new TLabel('Solicitação:')); // $cell = $row->addCell($solicitanteCRM); // // add a row for the field endereco // $row = $table_data->addRow(); // $row->addCell(new TLabel('Endereço:')); // $row->addCell($endereco); // // // add a row for the field endereco // $row = $table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $row->addCell($cidade_id); // add a row for the field Category // $row = $table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); // add a row for the field city // $row=$table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); /* // add a row for the field Phone $row = $table_data->addRow(); $row->addCell(new TLabel('Phone:')); $row->addCell($phone); // add a row for the field BirthDate $row->addCell(new TLabel('BirthDate:')); $row->addCell($birthdate); // add a row for the field status $row = $table_data->addRow(); $row->addCell(new TLabel('Status:')); $cell = $row->addCell($status); // add a row for the field Email $row->addCell(new TLabel('Email:')); $cell = $row->addCell($email); // add a row for the field gender $row->addCell(new TLabel('Gender:')); $row->addCell($gender); $row = $table_contact->addRow(); $cell = $row->addCell(new TLabel('<b>Contact</b>')); $cell->valign = 'top'; // add two fields inside the multifield in the second sheet $contacts_list->setHeight(100); $contacts_list->setClass('Contact'); // define the returning class $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200); $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200); $row = $table_contact->addRow(); $row->addCell($contacts_list); // create the radio button for the skills list $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name'); $table_skill->addRow()->addCell($lbl = new TLabel('Skills')); $table_skill->addRow()->addCell($skill_list); $lbl->setFontStyle('b'); * */ // 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 (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('ClienteList', 'onReload')), 'Ir para Listagem'); $button2->setImage('ico_datagrid.gif'); // create an action button $button3 = new TButton('action3'); $action3 = new TAction(array('RegistroForm', 'onEdit')); $action3->setParameter('fk', $codigoCRM); $button3->setImage('ico_save.png'); $button3->setAction($action3, 'Inserir Registro'); // define wich are the form fields $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2, $button3)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button1); $row->addCell($button2); $row->addCell($button3); $table_layout = new TTable(); $table_layout->addRow()->addCell($this->form); $table_layout->addRow()->addCell($subtable); // // add a row for the field gender // $row->addCell(new TLabel('Gender:')); // $row->addCell($registroREG); // // // add a row for the field Category // $row = $table->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($registroREG); // add the form inside the page parent::add($panel); parent::add($table_layout); // creates the form $this->form2 = new TForm('form_clienteRegistro Detalhe'); //dados do cliente CRM TTransaction::open('db_crmbf'); $criteria2 = new TCriteria(); // $criteria->add(new TFilter('crm_id', '=', $_GET['key'])); $criteria2->setProperty('order', 'id desc'); $repository2 = new TRepository('Registro'); $reg = $repository2->load($criteria2); foreach ($reg as $regs) { $row = $table->addRow(); $row->addCell(new TLabel('ID:')); $cell = $row->addCell($regs->id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->crm_id); $row = $table->addRow(); $row->addCell(new TLabel('CRM:')); $cell = $row->addCell($regs->tiporegistro_id); $row = $table->addRow(); $row->addCell(new TLabel('Tempo:')); $cell = $row->addCell($regs->tempo_registro); $row = $table->addRow(); $row->addCell(new TLabel('Data:')); $cell = $row->addCell($regs->data_registro); $row = $table->addRow(); $row->addCell(new TLabel('Horario:')); $cell = $row->addCell($regs->hora_registro); $row = $table->addRow(); $row->addCell(new TLabel('Numero Registro:')); $cell = $row->addCell($regs->numero_registro); $row = $table->addRow(); $row->addCell(new TLabel('Registro:')); $cell = $row->addCell($regs->registro); $row = $table->addRow(); $row->addCell(new TLabel(' ')); $cell = $row->addCell(' '); // $idREG = $regs->id; // $crm_idREG = $regs->crm_id; // $tiporegistro_idREG = $regs->tiporegistro_id; // $tempoREG = $regs->tempo_registro; // $dataREG = $regs->data_registro; // $horaREG = $regs->hora_registro; // $numRegistroREG = $regs->numero_registro; // $registroREG = $regs->registro; } TTransaction::close(); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // security check TTransaction::open('library'); if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // creates the form $this->form = new TForm('form_Member_Report'); $this->form->class = 'tform'; $this->form->style = 'width: 600px'; $table = new TTable(); $table->width = '100%'; $this->form->add($table); $table->addRowSet(new TLabel(_t('Report filters')), '')->class = 'tformtitle'; // create the form fields $name = new TEntry('name'); $city_id = new TSeekButton('city_id'); $city_name = new TEntry('city_name'); $category_id = new TDBCombo('category_id', 'library', 'Category', 'id', 'description'); $output_type = new TRadioGroup('output_type'); $options = array(); $options['pdf'] = 'PDF'; $options['rtf'] = 'RTF'; $output_type->addItems($options); $output_type->setValue('pdf'); $output_type->setLayout('horizontal'); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Member_Report'); $action->setParameter('model', 'City'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'city_id'); $action->setParameter('receive_field', 'city_name'); $city_id->setAction($action); // define the sizes $name->setSize(200); $city_id->setSize(100); $category_id->setSize(100); $city_name->setEditable(FALSE); // add a row for the field name $row = $table->addRow(); $row->addCell(new TLabel(_t('Name') . ': ')); $cell = $row->addCell($name); // add a row for the field city_id $row = $table->addRow(); $row->addCell(new TLabel(_t('City') . ': ')); $row->addMultiCell($city_id, $city_name); // add a row for the field category_id $row = $table->addRow(); $row->addCell(new TLabel(_t('Category') . ': ')); $cell = $row->addCell($category_id); // add a row for the field category_id $row = $table->addRow(); $row->addCell(new TLabel(_t('Output') . ': ')); $cell = $row->addCell($output_type); // create an action button (save) $save_button = new TButton('generate'); // define the button action $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate')); $save_button->setImage('ico_save.png'); $table->addRowSet($save_button, '')->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button)); $vbox = new TVBox(); $vbox->add($this->form); // add the form to the page parent::add($vbox); }
/** * */ public function makeTSeekButton($properties) { $widget = new TSeekButton((string) $properties->{'name'}); $widget->setSize((int) $properties->{'width'}); if ($properties->{'database'} and $properties->{'model'}) { $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', (string) $properties->{'database'}); if (isset($this->form)) { if ($this->form instanceof TForm) { $action->setParameter('parent', $this->form->getName()); } } $action->setParameter('model', (string) $properties->{'model'}); $action->setParameter('display_field', (string) $properties->{'display'}); $action->setParameter('receive_key', (string) $properties->{'name'}); $action->setParameter('receive_field', (string) $properties->{'receiver'}); $widget->setAction($action); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // security check TTransaction::open('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_Book'); // creates a table $table1 = new TTable(); $table2 = new TTable(); $table3 = new TTable(); $notebook = new TNotebook(550, 400); $notebook->appendPage(_t('Basic data'), $table1); $notebook->appendPage(_t('Secundary data'), $table2); $notebook->appendPage(_t('Items'), $table3); // add the table inside the form $this->form->add($notebook); // create the form fields $id = new TEntry('id'); $title = new TEntry('title'); $isbn = new TEntry('isbn'); $call_number = new TEntry('call_number'); $author_id = new TSeekButton('author_id'); $author_name = new TEntry('author_name'); $edition = new TEntry('edition'); $volume = new TEntry('volume'); $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description'); $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description'); $publisher_id = new TSeekButton('publisher_id'); $publisher_name = new TEntry('publisher_name'); $publish_place = new TEntry('publish_place'); $publish_date = new TDate('publish_date'); $abstract = new TText('abstract'); $notes = new TText('notes'); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Publisher'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'publisher_id'); $action->setParameter('receive_field', 'publisher_name'); $publisher_id->setAction($action); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_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); // define the sizes $id->setSize(100); $title->setSize(340); $isbn->setSize(120); $call_number->setSize(120); $author_id->setSize(100); $edition->setSize(120); $volume->setSize(120); $collection_id->setSize(100); $classification_id->setSize(100); $publisher_id->setSize(100); $publish_place->setSize(140); $publish_date->setSize(100); $abstract->setSize(400, 40); $notes->setSize(400, 40); $id->setEditable(FALSE); $publisher_name->setEditable(FALSE); $author_name->setEditable(FALSE); // add a row for the field id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Code'))); $cell = $row->addCell($id); $cell->colspan = 3; // add a row for the field title $row = $table1->addRow(); $row->addCell(new TLabel(_t('Title'))); $cell = $row->addCell($title); $cell->colspan = 3; // add a row for the field isbn/call_nuber $row = $table1->addRow(); $row->addCell(new TLabel('ISBN' . ': ')); $row->addCell($isbn); $row->addCell(new TLabel(_t('Call'))); $row->addCell($call_number); // add a row for the field author_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Author') . ': ')); $row->addCell($author_id); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($author_name); // add a row for the field edition/volume $row = $table1->addRow(); $row->addCell(new TLabel(_t('Edition') . ': ')); $row->addCell($edition); $row->addCell(new TLabel(_t('Volume') . ': ')); $row->addCell($volume); // add a row for the field collection_id/classification_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Collection') . ': ')); $row->addCell($collection_id); $row->addCell(new TLabel(_t('Classification') . ': ')); $row->addCell($classification_id); // add a row for the field publisher_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Publisher') . ': ')); $row->addCell($publisher_id); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($publisher_name); // add a row for the field publish_place $row = $table1->addRow(); $row->addCell(new TLabel(_t('Place') . ': ')); $row->addCell($publish_place); $row->addCell(new TLabel(_t('Date') . ': ')); $row->addCell($publish_date); // add a row for the field abstract $row = $table1->addRow(); $row->addCell(new TLabel(_t('Abstract') . ': ')); $cell = $row->addCell($abstract); $cell->colspan = 3; // add a row for the field notes $row = $table1->addRow(); $row->addCell(new TLabel(_t('Notes') . ': ')); $cell = $row->addCell($notes); $cell->colspan = 3; // secundary authors $authors = new TMultiField('author_list'); $sub_author_id = new TSeekButton('id'); $sub_author_name = new TEntry('name'); $sub_author_name->setEditable(FALSE); $sub_author_id->setSize(50); $sub_author_name->setSize(300); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Author'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'author_list_id'); $action->setParameter('receive_field', 'author_list_name'); $sub_author_id->setAction($action); $authors->setHeight(80); $authors->setClass('Author'); $authors->addField('id', _t('Author'), $sub_author_id, 50); $authors->addField('name', _t('Name'), $sub_author_name, 300); $row = $table2->addRow(); $row->addCell($l = new TLabel(_t('Authors'))); $l->setFontStyle('b'); $row = $table2->addRow(); $row->addCell($authors); // secundary subjects $subjects = new TMultiField('subject_list'); $sub_subject_id = new TSeekButton('id'); $sub_subject_name = new TEntry('name'); $sub_subject_name->setEditable(FALSE); $sub_subject_id->setSize(50); $sub_subject_name->setSize(300); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Subject'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'subject_list_id'); $action->setParameter('receive_field', 'subject_list_name'); $sub_subject_id->setAction($action); $subjects->setHeight(80); $subjects->setClass('Subject'); $subjects->addField('id', _t('Subject'), $sub_subject_id, 50); $subjects->addField('name', _t('Name'), $sub_subject_name, 300); $row = $table2->addRow(); $row->addCell($l = new TLabel(_t('Subjects'))); $l->setFontStyle('b'); $row = $table2->addRow(); $row->addCell($subjects); // items $items = new TMultiField('item_list'); $item_barcode = new TEntry('barcode'); $item_status_id = new TComboCombined('status_id', 'status_description'); $item_cost = new TEntry('cost'); $item_acquire_date = new TDate('acquire_date'); $item_notes = new TEntry('notes'); $item_status_id->setSize(150); $item_cost->setSize(100); $item_acquire_date->setSize(100); TTransaction::open('library'); $rep = new TRepository('Status'); $objects = $rep->load(new TCriteria()); $options = array(); if ($objects) { foreach ($objects as $object) { $options[$object->id] = $object->description; } } $item_status_id->addItems($options); TTransaction::close(); $items->setHeight(140); $items->setClass('Item'); $items->addField('barcode', _t('Barcode'), $item_barcode, 80); $items->addField('status_id', _t('Status'), $item_status_id, 100); $items->addField('cost', _t('Cost'), $item_cost, 80); $items->addField('acquire_date', _t('Acquire date'), $item_acquire_date, 80); $items->addField('notes', _t('Notes'), $item_notes, 150); $row = $table3->addRow(); $row->addCell($l = new TLabel(_t('Items'))); $l->setFontStyle('b'); $row = $table3->addRow(); $row->addCell($items); // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); // add a row for the form action $row = $table1->addRow(); $row->addCell($save_button); // define wich are the form fields $this->form->setFields(array($id, $title, $isbn, $call_number, $author_id, $author_name, $edition, $volume, $collection_id, $classification_id, $publisher_id, $publisher_name, $publish_place, $publish_date, $abstract, $notes, $authors, $subjects, $items, $save_button)); // add the form to the page parent::add($this->form); }
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); }
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); }
/** * 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); }
/** * 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); }
function onDelete($param) { // obtém o parâmetro $key $key = $param['key']; // define duas ações $action1 = new TAction(array($this, 'Delete')); $action2 = new TAction(array($this, 'teste')); // define os parâmetros de cada ação $action1->setParameter('key', $key); $action2->setParameter('key', $key); // exibe um diálogo ao usuário new TQuestion('Deseja realmente excluir o registro ?', $action1, $action2); }