/** * 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; $panel = new TPanel(100, 10); // add the notebook inside the form $this->form->add($panel); $panel->put(new TLabel('CRM Titulo:'), 0, 0); // $notebook->appendPage('Cidade', $table_contact); // $notebook->appendPage('Skill (aggregation)', $table_skill); // create the form fields $code = new TEntry('id'); // $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo'); $crm_id = new TEntry('crm_nome'); $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'); // add field validators $registro->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); $crm_id->setSize(320); $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); $panel->put("Codigo: ", 10, 25); $panel->put("CRM: ", 10, 50); $panel->put("Tipo: ", 10, 75); $panel->put("Tempo: ", 10, 100); $panel->put("Data: ", 10, 125); $panel->put("Horario: ", 10, 150); $panel->put("Nº Registro: ", 10, 175); $panel->put("Registro: ", 10, 200); $panel->put($code, 100, 25); $panel->put($crm_id, 100, 50); $panel->put($tiporegistro_id, 100, 75); $panel->put($temporegistro, 100, 100); $panel->put($dataregistro, 100, 125); $panel->put($hora_registro, 100, 150); $panel->put($numero_registro, 100, 175); $panel->put($registro, 100, 200); // $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); // 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'); $button1->setProperty('width', 150); // create an action button (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('RegistroList', 'onReload')), 'Ir para Listagem'); $button2->setImage('ico_datagrid.gif'); $button2->setProperty('width', 100); $panel->put($button1, 100, 325); $panel->put($button2, 200, 325); // 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($panel); // parent::add($table_layout); }
/** * 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_registro'); // create the form fields $name = new TEntry('nome'); // $email = new TEntry('email'); // $telefone = new TEntry('telefone'); // $celular = new TEntry('celular'); // $skype = new TEntry('skype'); // $endereco = new TEntry('endereco'); // $bairro = new TEntry('bairro'); // $cidade_id = new TEntry('cidade_id'); $name->setSize(170); // $email->setSize(170); // $telefone->setSize(170); // $celular->setSize(170); // $skype->setSize(170); // $endereco->setSize(170); // $bairro->setSize(126); // $cidade_id->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 = PHP_SAPI == 'cli' ? 40 : 80; $row->addCell($name); /* $cell=$row->addCell(''); $row->addCell($email); $cell=$row->addCell(''); $row->addCell($telefone); $cell=$row->addCell(''); $row->addCell($celular); $cell=$row->addCell(''); $row->addCell($skype); $cell=$row->addCell(''); $row->addCell($endereco); $cell=$row->addCell(''); $row->addCell($bairro); $cell=$row->addCell(''); $row->addCell($cidade_id); * */ $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'); $button2 = new TButton('novo'); $button2->setAction(new TAction(array('RegistroForm', 'onEdit')), 'Novo'); $button2->setProperty('key', ''); $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, $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('CRM Titulo', 'crm_nome', 'left', 170, new TAction(array($this, 'onReload')), array('order', 'nome')); $this->datagrid->addQuickColumn('Tipo', 'tiporegistro_nome', 'left', 140); $this->datagrid->addQuickColumn('Tempo', 'tempo_registro', 'left', 190); $this->datagrid->addQuickColumn('Data', 'data_registro', 'left', 150); $this->datagrid->addQuickColumn('Hora', 'hora_registro', 'left', 150); $this->datagrid->addQuickColumn('Nª Registro', 'numero_registro', 'left', 150); // creates two datagrid actions $this->datagrid->addQuickAction('Edit', new TDataGridAction(array('RegistroForm', '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 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); }