/**
  * Open an input dialog
  */
 public function onInputDialog($param)
 {
     $name = new TEntry('name');
     $amount = new TEntry('amount');
     $name->setValue($param['key']);
     $form = new TForm('input_form');
     $form->style = 'padding:20px';
     $table = new TTable();
     $table->addRowSet(new TLabel('Name: '), $name);
     $table->addRowSet($lbl = new TLabel('Amount: '), $amount);
     $lbl->setFontColor('red');
     $form->setFields(array($name, $amount));
     $form->add($table);
     // show the input dialog
     new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm');
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Multi Cell');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $min = new TEntry('min');
     $max = new TEntry('max');
     $start_date = new TDate('start_date');
     $end_date = new TDate('end_date');
     $address = new TEntry('address');
     // adjust the size of the code
     $id->setSize(70);
     $start_date->setSize(70);
     $end_date->setSize(70);
     $min->setSize(87);
     $max->setSize(87);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     // first approach
     $table->addRowSet(new TLabel('Value'), array($min, new TLabel('To'), $max));
     // second approach
     $row = $table->addRow();
     $row->addCell(new TLabel('Date'));
     $row->addMultiCell($start_date, $end_date);
     $table->addRowSet(new TLabel('Address'), $address);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Columns');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $text = new TText('text');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     $city->addItems($items);
     // adjust the size of the code
     $id->setSize(70);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     $table->addRowSet(new TLabel('City'), $city);
     $table->addRowSet(new TLabel('Address'), $address);
     $table->addRowSet(new TLabel('Telephone'), $telephone);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
Пример #4
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_Note');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->addRowSet(new TLabel(_t('Note')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_issue = new THidden('id_issue');
     $note = new THtmlEditor('note');
     // define the sizes
     $id_issue->setSize(100);
     $note->setSize(640, 200);
     $note->style = 'margin: 10px';
     // add a row for the field id_issue
     $row = $table->addRow();
     $row->addCell($id_issue);
     // add a row for the field note
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Notes') . ': '));
     $row = $table->addRow();
     $row->addCell($note);
     $lbl->setFontStyle('b');
     // 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 = $table->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($id_issue, $note, $save_button));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Пример #5
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 400px';
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Password')), '')->class = 'tformtitle';
     $this->form->add($table);
     // create the form fields
     $current_password = new TPassword('current_password');
     $new_password1 = new TPassword('new_password1');
     $new_password2 = new TPassword('new_password2');
     $current_password->addValidation(_t('Current password'), new TRequiredValidator());
     $new_password1->addValidation(_t('New password'), new TRequiredValidator());
     $new_password2->addValidation(_t('Confirm new password'), new TRequiredValidator());
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Current password') . ': '));
     $row->addCell($current_password);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('New password') . ': '));
     $row->addCell($new_password1);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Confirm new password') . ': '));
     $row->addCell($new_password2);
     // 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');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($current_password, $new_password1, $new_password2, $save_button));
     $container = new TVBox();
     $container->add($this->form);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_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);
 }
Пример #7
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_System_user');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel(_t('Users')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $id->setValue(TSession::getValue('System_user_id'));
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('System_user_name'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search');
     $new_button->setAction(new TAction(array('SystemUserForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     // add a row for the form actions
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     $this->datagrid->style = 'width: 100%';
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $name = new TDataGridColumn('name', _t('Name'), 'center');
     $login = new TDataGridColumn('login', _t('Login'), 'center');
     $email = new TDataGridColumn('email', _t('Email'), 'center');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($login);
     $this->datagrid->addColumn($email);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'name');
     $name->setAction($order_name);
     $order_login = new TAction(array($this, 'onReload'));
     $order_login->setParameter('order', 'login');
     $login->setAction($order_login);
     $order_email = new TAction(array($this, 'onReload'));
     $order_email->setParameter('order', 'email');
     $email->setAction($order_email);
     // inline editing
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('id');
     $name->setEditAction($name_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('SystemUserForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o grey fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Пример #8
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Subject');
     // defines the filter field
     parent::setFilterField('name');
     // creates the form
     $this->form = new TForm('form_search_Subject');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Subjects')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('Subject_name'));
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ':'));
     $row->addCell($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('ico_find.png');
     $new_button->setAction(new TAction(array('SubjectForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($name, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn(_t('Code'), 'id', 'right', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Name'), 'name', 'left', 440, new TAction(array($this, 'onReload')), array('order', 'name'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('SubjectForm', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_search_PlantaValores');
     $this->form->class = 'tform';
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Planta de Valores'), '')->class = 'tformtitle';
     $this->form->add($table);
     $plantavalores_id = new TEntry('plantavalores_id');
     $plantavalores_id->setValue(TSession::getValue('plantavalores_id'));
     $anobase = new TEntry('anobase');
     $anobase->setValue(TSession::getValue('anobase'));
     $row = $table->addRowSet(new TLabel('ID: '), $plantavalores_id);
     $row = $table->addRowSet(new TLabel('Ano Base: '), $anobase);
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('PlantaValoresForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($plantavalores_id, $anobase, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     $plantavalores_id = new TDataGridColumn('plantavalores_id', 'ID', 'right');
     $anobase = new TDataGridColumn('anobase', 'Ano Base', 'left');
     $this->datagrid->addColumn($plantavalores_id);
     $this->datagrid->addColumn($anobase);
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'plantavalores_id');
     $plantavalores_id->setAction($order_id);
     $order_data = new TAction(array($this, 'onReload'));
     $order_data->setParameter('order', 'anobase');
     $anobase->setAction($order_data);
     $action1 = new TDataGridAction(array('PlantaValoresForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('anobase_id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('plantavalores_id');
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->createModel();
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_System_user');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     $frame_groups = new TFrame(NULL, 280);
     $frame_groups->setLegend('Grupos');
     $frame_groups->style .= ';margin: 4px';
     $frame_programs = new TFrame(NULL, 280);
     $frame_programs->setLegend('Programas');
     $frame_programs->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $repassword = new TPassword('repassword');
     $email = new TEntry('email');
     $multifield_programs = new TMultiField('programs');
     $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name');
     $program_name = new TEntry('program_name');
     $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name');
     $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name');
     $frontpage_name = new TEntry('frontpage_name');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($groups);
     $frame_groups->add($scroll);
     $frame_programs->add($multifield_programs);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200);
     $login->setSize(150);
     $password->setSize(150);
     $email->setSize(200);
     $frontpage_id->setSize(100);
     $multifield_programs->setHeight(140);
     // outros
     $id->setEditable(false);
     $program_name->setEditable(false);
     $frontpage_name->setEditable(false);
     // validations
     $name->addValidation('Nome', new TRequiredValidator());
     $login->addValidation('Login', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $program_id->setSize(50);
     $program_name->setSize(200);
     // configuracoes multifield
     $multifield_programs->setClass('SystemProgram');
     $multifield_programs->addField('id', 'ID', $program_id, 60);
     $multifield_programs->addField('name', 'Nome', $program_name, 250);
     $multifield_programs->setOrientation('horizontal');
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name);
     $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email);
     $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword);
     $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name);
     $row = $table->addRow();
     $cell = $row->addCell($frame_groups);
     $cell->colspan = 2;
     $row = $table->addRow();
     $cell = $row->addCell($frame_programs);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), 'Voltar para listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * 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);
 }
Пример #12
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_search_Contribuinte');
     $this->form->class = 'tform';
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Contribuinte'), '')->class = 'tformtitle';
     $this->form->add($table);
     $contribuinte_id = new TEntry('contribuinte_id');
     $contribuinte_id->setValue(TSession::getValue('contribuinte_id'));
     $contribuinte_nome = new TEntry('contribuinte_nome');
     $contribuinte_nome->setValue(TSession::getValue('contribuinte_nome'));
     $row = $table->addRowSet(new TLabel('ID: '), $contribuinte_id);
     $row = $table->addRowSet(new TLabel('Nome/Razão Social: '), $contribuinte_nome);
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('ContribuinteForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($contribuinte_id, $contribuinte_nome, $find_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     $contribuinte_id = new TDataGridColumn('contribuinte_id', 'ID', 'right');
     $contribuinte_nome = new TDataGridColumn('contribuinte_nome', 'Nome/Razão Social', 'left');
     $contribuinte_tipo = new TDataGridColumn('contribuinte_tipo', 'Tipo', 'left');
     $contribuinte_tipo = new TDataGridColumn('contribuinte_tipos', 'Tipo', 'left');
     $this->datagrid->addColumn($contribuinte_id);
     $this->datagrid->addColumn($contribuinte_nome);
     $this->datagrid->addColumn($contribuinte_tipo);
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'contribuinte_id');
     $contribuinte_id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'contribuinte_nome');
     $contribuinte_nome->setAction($order_name);
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('contribuinte_id');
     $contribuinte_nome->setEditAction($name_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('ContribuinteForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('contribuinte_id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('contribuinte_id');
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     $this->datagrid->createModel();
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Пример #13
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->add($table);
     $table->width = '100%';
     $this->form->style = 'width: 750px';
     $this->form->class = 'tform';
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     $table1 = new TTable();
     $table2 = new TTable();
     // create the form fields
     $id = new TEntry('id');
     $id_user = new TDBCombo('id_user', 'changeman', 'Member', 'id', 'name');
     $id_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'complete_description');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $id_release = new TDBCombo('id_release', 'changeman', 'Release', 'id', 'name');
     $id_member = new TDBCombo('id_member', 'changeman', 'Member', 'id', 'name');
     $register_date = new TDate('register_date');
     $close_date = new TDate('close_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $solution = new THtmlEditor('solution');
     $id_user->addValidation(_t('User'), new TRequiredValidator());
     $id_status->addValidation(_t('Status'), new TRequiredValidator());
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id->setSize(100);
     $id_user->setSize(200);
     $id_status->setSize(200);
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $id_release->setSize(200);
     $id_member->setSize(200);
     $register_date->setSize(100);
     $close_date->setSize(100);
     $time->setSize(200);
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $solution->setSize(680, 300);
     $register_date->setMask('yyyy-mm-dd');
     $close_date->setMask('yyyy-mm-dd');
     $id->setEditable(FALSE);
     // add a row for the field id
     $table1->addRowSet(new TLabel('ID:'), $id);
     $table1->addRowSet(new TLabel(_t('User') . ': '), $id_user);
     $table1->addRowSet(new TLabel(_t('Status') . ': '), $id_status);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Release') . ': '), $id_release);
     $table2->addRowSet(new TLabel(_t('Assigned to')), $id_member);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), $register_date);
     $table2->addRowSet(new TLabel(_t('Due date') . ':'), $close_date);
     $table2->addRowSet(new TLabel(_t('Time') . ':'), $time);
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $subnotebook = new TNotebook();
     $subnotebook->setSize(710, 320);
     $subnotebook->style = 'padding: 50px';
     $subnotebook->appendPage(_t('Description'), $description);
     $subnotebook->appendPage(_t('Solution'), $solution);
     $hbox = new THBox();
     $hbox->add($subnotebook);
     $hbox->style = 'margin: 10px';
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($id, $id_user, $id_status, $id_project, $id_priority, $id_category, $id_release, $id_member, $register_date, $close_date, $time, $title, $description, $solution, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
Пример #14
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_search_Issue');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Issues')), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'description_translated');
     $filter_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $filter_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $filter_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $filter_title = new TEntry('title');
     $filter_status->setValue(TSession::getValue('Issue_id_status'));
     $filter_project->setValue(TSession::getValue('Issue_id_project'));
     $filter_priority->setValue(TSession::getValue('Issue_id_priority'));
     $filter_category->setValue(TSession::getValue('Issue_id_category'));
     $filter_title->setValue(TSession::getValue('Issue_title'));
     $filter_title->setSize(480);
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Status') . ': '));
     $row->addCell($filter_status);
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($filter_project);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Priority') . ': '));
     $row->addCell($filter_priority);
     $row->addCell(new TLabel(_t('Category') . ': '));
     $row->addCell($filter_category);
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($filter_title);
     $cell->colspan = 3;
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') {
         $class = 'NewIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     } else {
         $class = 'UpdateIssueForm';
         $new_button->setAction(new TAction(array($class, 'onEdit')), _t('New'));
         $new_button->setImage('ico_new.png');
     }
     TTransaction::close();
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     // define wich are the form fields
     $this->form->setFields(array($filter_status, $filter_project, $filter_priority, $filter_category, $filter_title, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 50);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 260);
     $id_status = new TDataGridColumn('status', _t('Status'), 'left', 100);
     $id_priority = new TDataGridColumn('priority', _t('Priority'), 'left', 100);
     $id_category = new TDataGridColumn('category', _t('Category'), 'left', 100);
     $register_date = new TDataGridColumn('register_date', _t('Start date'), 'left', 110);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order3 = new TAction(array($this, 'onReload'));
     $order4 = new TAction(array($this, 'onReload'));
     $order5 = new TAction(array($this, 'onReload'));
     $order6 = new TAction(array($this, 'onReload'));
     $order7 = new TAction(array($this, 'onReload'));
     $order8 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'title');
     $order3->setParameter('order', 'id_status');
     $order4->setParameter('order', 'id_priority');
     $order5->setParameter('order', 'id_category');
     $order6->setParameter('order', 'register_date');
     // assign the ordering actions
     $id->setAction($order1);
     $title->setAction($order2);
     $id_status->setAction($order3);
     $id_priority->setAction($order4);
     $id_category->setAction($order5);
     $register_date->setAction($order6);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($title);
     $this->datagrid->addColumn($id_status);
     $this->datagrid->addColumn($id_priority);
     $this->datagrid->addColumn($id_category);
     $this->datagrid->addColumn($register_date);
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'ADMINISTRATOR' or Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MANAGER') {
         // creates two datagrid actions
         $class = 'UpdateIssueForm';
         $action1 = new TDataGridAction(array($class, 'onEdit'));
         $action1->setLabel(_t('Edit'));
         $action1->setImage('ico_edit.png');
         $action1->setField('id');
         $action2 = new TDataGridAction(array($this, 'onDelete'));
         $action2->setLabel(_t('Delete'));
         $action2->setImage('ico_delete.png');
         $action2->setField('id');
         // add the actions to the datagrid
         $this->datagrid->addAction($action1);
         $this->datagrid->addAction($action2);
     } else {
         if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'MEMBER') {
             // creates two datagrid actions
             $class = 'UpdateIssueForm';
             $action1 = new TDataGridAction(array($class, 'onEdit'));
             $action1->setLabel(_t('Edit'));
             $action1->setImage('ico_edit.png');
             $action1->setField('id');
             // add the actions to the datagrid
             $this->datagrid->addAction($action1);
         }
     }
     // creates two datagrid actions
     $class = 'ViewIssueForm';
     $action3 = new TDataGridAction(array($class, 'onView'));
     $action3->setLabel(_t('View'));
     $action3->setImage('ico_view.png');
     $action3->setField('id');
     $class = 'NoteForm';
     $action4 = new TDataGridAction(array($class, 'onEdit'));
     $action4->setLabel(_t('Comment'));
     $action4->setImage('ico_new.png');
     $action4->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action4);
     TTransaction::close();
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
 /**
  * Form constructor
  * @param $param Request
  */
 public function __construct($param)
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Cliente');
     $this->form->class = 'tform';
     // change CSS class
     $note = new TNotebook(400, 300);
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Clientes'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     // campo para telefones
     $multifield = new TMultiField('telefone');
     $telefone_id = new TEntry('id');
     $telefone_id->setEditable(false);
     $telefone = new TEntry('numero');
     $telefone->setMask('(99)99999-9999');
     //    campo para emails
     $multifield_email = new TMultiField('email');
     $email = new TEntry('email');
     $email_id = new TEntry('id');
     $email->addValidation('email', new TEmailValidator());
     $multifield->addField('id', 'Codigo', $telefone_id, 200);
     $multifield->addField('numero', 'Telefone', $telefone, 200, true);
     $multifield_email->addField('id', 'Codigo', $email_id, 200);
     $multifield_email->addField('email', 'Email', $email, 200, true);
     // define the sizes
     $id->setSize(100);
     $nome->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('nome:'), $nome);
     $this->form->setFields(array($id, $nome, $multifield, $multifield_email));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'bs:floppy-disk red');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'bs:edit green');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     $note->appendPage('Clientes', $table);
     $note->appendPage('Telefone', $multifield);
     $note->appendPage('Email', $multifield_email);
     $this->form->add($note);
     // vertical box container
     $container = new TVBox();
     $container->style = 'width: 90%';
     // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add(TPanelGroup::pack('Title', $this->form));
     parent::add($container);
 }
Пример #16
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Sale');
     $this->form->class = 'tform';
     // CSS class
     parent::include_css('app/resources/custom-frame.css');
     $table_master = new TTable();
     $table_master->width = '100%';
     $table_master->addRowSet(new TLabel('Sale'), '', '')->class = 'tformtitle';
     // add a table inside form
     $table_general = new TTable();
     $table_general->width = '100%';
     $tableProduct = new TTable();
     $tableProduct->width = '100%';
     $frame_general = new TFrame();
     $frame_general->setLegend('General data');
     $frame_general->style = 'background:whiteSmoke';
     $frame_general->add($table_general);
     $table_master->addRow()->addCell($frame_general)->colspan = 2;
     $row = $table_master->addRow();
     $row->addCell($tableProduct);
     $this->form->add($table_master);
     // master fields
     $id = new TEntry('id');
     $date = new TDate('date');
     $customer_id = new TDBSeekButton('customer_id', 'samples', $this->form->getName(), 'Customer', 'name', 'customer_id', 'customer_name');
     $customer_name = new TEntry('customer_name');
     $obs = new TText('obs');
     // detail fields
     $product_id = new TDBSeekButton('product_id', 'samples', $this->form->getName(), 'Product', 'description', 'product_id', 'product_name');
     $product_name = new TEntry('product_name');
     $sale_price = new TEntry('product_price');
     $amount = new TEntry('product_amount');
     $discount = new TEntry('product_discount');
     $total = new TEntry('product_total');
     $product_id->setExitAction(new TAction(array($this, 'onProductChange')));
     $id->setSize(40);
     $date->setSize(100);
     $obs->setSize(400, 100);
     $product_id->setSize(50);
     $customer_id->setSize(50);
     $id->setEditable(false);
     $product_name->setEditable(false);
     $customer_name->setEditable(false);
     $date->addValidation('Date', new TRequiredValidator());
     $customer_id->addValidation('Customer', new TRequiredValidator());
     // pedido
     $table_general->addRowSet(new TLabel('ID'), $id);
     $table_general->addRowSet($label_date = new TLabel('Date (*)'), $date);
     $table_general->addRowSet($label_customer = new TLabel('Customer (*)'), array($customer_id, $customer_name));
     $table_general->addRowSet(new TLabel('Obs'), $obs);
     $label_date->setFontColor('#FF0000');
     // products
     $frame_product = new TFrame();
     $frame_product->setLegend('Products');
     $row = $tableProduct->addRow();
     $row->addCell($frame_product);
     $add_product = new TButton('add_product');
     $action_product = new TAction(array($this, 'onProductAdd'));
     $add_product->setAction($action_product, 'Register');
     $add_product->setImage('fa:save');
     $subtable_product = new TTable();
     $frame_product->add($subtable_product);
     $subtable_product->addRowSet($label_product = new TLabel('Product (*)'), array($product_id, $product_name));
     $subtable_product->addRowSet($label_sale_price = new TLabel('Price (*)'), $sale_price);
     $subtable_product->addRowSet($label_amount = new TLabel('Amount(*)'), $amount);
     $subtable_product->addRowSet(new TLabel('Discount'), $discount);
     $subtable_product->addRowSet($add_product);
     $label_product->setFontColor('#FF0000');
     $label_amount->setFontColor('#FF0000');
     $label_sale_price->setFontColor('#FF0000');
     $this->product_list = new TQuickGrid();
     $this->product_list->setHeight(175);
     $this->product_list->makeScrollable();
     $this->product_list->disableDefaultClick();
     $this->product_list->addQuickColumn('', 'edit', 'left', 50);
     $this->product_list->addQuickColumn('', 'delete', 'left', 50);
     $this->product_list->addQuickColumn('ID', 'product_id', 'center', 40);
     $this->product_list->addQuickColumn('Product', 'product_name', 'left', 200);
     $this->product_list->addQuickColumn('Amount', 'product_amount', 'left', 60);
     $this->product_list->addQuickColumn('Price', 'product_price', 'right', 80);
     $this->product_list->addQuickColumn('Discount', 'product_discount', 'right', 80);
     $this->product_list->createModel();
     $row = $tableProduct->addRow();
     $row->addCell($this->product_list);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onClear')), _t('New'));
     $new_button->setImage('ico_new.png');
     // define form fields
     $this->formFields = array($id, $date, $customer_id, $customer_name, $obs, $product_id, $product_name, $sale_price, $amount, $discount, $total, $add_product, $save_button, $new_button);
     $this->form->setFields($this->formFields);
     $table_master->addRowSet(array($save_button, $new_button), '', '')->class = 'tformaction';
     // CSS class
     // create the page container
     $container = new TVBox();
     $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add($this->form);
     parent::add($container);
 }
Пример #17
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Servidor');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Servidores'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $identificacao = new TEntry('identificacao');
     $identificacao->setValue(TSession::getValue('Servidor_identificacao'));
     $servidor = new TEntry('servidor');
     $servidor->setValue(TSession::getValue('Servidor_servidor'));
     //$unidade = new TEntry('unidade');
     //$unidade->setValue(TSession::getValue('Servidor_unidade'));
     // add rows for the filter fields
     $row = $table->addRowSet(new TLabel('Identificação' . ': '), $identificacao);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new TButton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('ServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     //$this->form->setFields(array($identificacao, $servidor, $unidade, $find_button, $new_button));
     $this->form->setFields(array($identificacao, $servidor, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'center');
     $identificacao = new TDataGridColumn('identificacao', 'Identificação', 'left');
     $servidor = new TDataGridColumn('servidor', 'Servidor', 'left');
     $unidade = new TDataGridColumn('unidade', 'Unidade', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($identificacao);
     $this->datagrid->addColumn($servidor);
     $this->datagrid->addColumn($unidade);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_identificacao = new TAction(array($this, 'onReload'));
     $order_identificacao->setParameter('order', 'identificacao');
     $identificacao->setAction($order_identificacao);
     $order_servidor = new TAction(array($this, 'onReload'));
     $order_servidor->setParameter('order', 'servidor');
     $servidor->setAction($order_servidor);
     $order_unidade = new TAction(array($this, 'onReload'));
     $order_unidade->setParameter('order', 'unidade');
     $unidade->setAction($order_unidade);
     // inline editing
     $identificacao_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $identificacao_edit->setField('id');
     $identificacao->setEditAction($identificacao_edit);
     $servidor_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_edit->setField('id');
     $servidor->setEditAction($servidor_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('ServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Пример #18
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->style = 'width: 750px';
     $this->form->add($table);
     $table->width = '100%';
     $this->form->class = 'tform';
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $user = new TEntry('user');
     $status = new TEntry('status');
     $project = new TEntry('project');
     $priority = new TEntry('priority');
     $category = new TEntry('category');
     $id_release = new TEntry('id_release');
     $member = new TEntry('member');
     $register_date = new TEntry('register_date');
     $close_date = new TEntry('close_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $solution = new THtmlEditor('solution');
     $user->setEditable(FALSE);
     $status->setEditable(FALSE);
     $project->setEditable(FALSE);
     $priority->setEditable(FALSE);
     $category->setEditable(FALSE);
     $id_release->setEditable(FALSE);
     $member->setEditable(FALSE);
     $register_date->setEditable(FALSE);
     $close_date->setEditable(FALSE);
     $time->setEditable(FALSE);
     $title->setEditable(FALSE);
     $description->setEditable(FALSE);
     $solution->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $user->setSize(200);
     $status->setSize(200);
     $project->setSize(200);
     $priority->setSize(200);
     $category->setSize(200);
     $id_release->setSize(100);
     $member->setSize(200);
     $register_date->setSize(100);
     $close_date->setSize(100);
     $time->setSize(200);
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $solution->setSize(680, 300);
     $register_date->setMask('yyyy-mm-dd');
     $close_date->setMask('yyyy-mm-dd');
     $id->setEditable(FALSE);
     $table1->addRowSet(new TLabel('ID:'), $id);
     $table1->addRowSet(new TLabel(_t('User') . ': '), $user);
     $table1->addRowSet(new TLabel(_t('Status') . ': '), $status);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $category);
     $table2->addRowSet(new TLabel(_t('Release') . ': '), $id_release);
     $table2->addRowSet(new TLabel(_t('Assigned to')), $member);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), $register_date);
     $table2->addRowSet(new TLabel(_t('Due date') . ':'), $close_date);
     $table2->addRowSet(new TLabel(_t('Time') . ':'), $time);
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $notes_area = new THtmlEditor('notes_area');
     $notes_area->setEditable(FALSE);
     $notes_area->setSize(680, 300);
     $subnotebook = new TNotebook();
     $subnotebook->setSize(710, 330);
     $subnotebook->appendPage(_t('Description'), $description);
     $subnotebook->appendPage(_t('Solution'), $solution);
     $subnotebook->appendPage(_t('Notes'), $notes_area);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($subnotebook);
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // define wich are the form fields
     $this->form->setFields(array($id, $user, $status, $project, $priority, $category, $id_release, $member, $register_date, $close_date, $time, $title, $description, $solution, $notes_area));
     // add the form to the page
     parent::add($this->form);
 }
Пример #19
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm('form_search_Imovel');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Imóvel'), '')->class = 'tformtitle';
     $this->form->add($table);
     $imovel_id = new TEntry('imovel_id');
     $imovel_id->setValue(TSession::getValue('s_id'));
     $logradouro = new TEntry('logradouro');
     $logradouro->setValue(TSession::getValue('s_name'));
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($imovel_id);
     $row = $table->addRow();
     $row->addCell(new TLabel('Logradouro' . ': '));
     $row->addCell($logradouro);
     $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('ImovelForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $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->form->setFields(array($imovel_id, $logradouro, $find_button, $new_button));
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $imovel_id = new TDataGridColumn('imovel_id', 'ID', 'center');
     $logradouro = new TDataGridColumn('logradouro', 'Logradouro', 'center');
     $this->datagrid->addColumn($imovel_id);
     $this->datagrid->addColumn($logradouro);
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'imovel_id');
     $imovel_id->setAction($order_id);
     $order_name = new TAction(array($this, 'onReload'));
     $order_name->setParameter('order', 'logradouro');
     $logradouro->setAction($order_name);
     // inline editing
     $name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $name_edit->setField('imovel_id');
     $logradouro->setEditAction($name_edit);
     $action1 = new TDataGridAction(array('ImovelForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('imovel_id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('imovel_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());
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->addRow()->addCell($this->form);
     $container->addRow()->addCell($this->datagrid);
     $container->addRow()->addCell($this->pageNavigation);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServForm');
     $this->form->class = 'tform';
     // creates the table container
     $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);
     $frame_horarios = new TFrame(NULL, 210);
     $frame_horarios->setLegend('Horários');
     $frame_horarios->style .= ';margin: 15px';
     $frame_ausencia = new TFrame(NULL, 210);
     $frame_ausencia->setLegend('Ausência');
     $frame_ausencia->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServForm', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_nome = new TEntry('servidor_nome');
     $diames = new TDate('diames');
     $entrada = new TEntry('entrada');
     $intervalo_inicio = new TEntry('intervalo_inicio');
     $intervalo_fim = new TEntry('intervalo_fim');
     $saida = new TEntry('saida');
     $ausencia_id = new TDBSeekButton('ausencia_id', 'lacenrh', 'form_FreqServForm', 'Ausencia', 'ausencia', 'ausencia_id', 'ausencia_desc');
     $ausencia_desc = new TEntry('ausencia_desc');
     $horas_justificadas = new TEntry('horas_justificadas');
     $justificativa = new TText('justificativa');
     $horas_trabalhadas = new TEntry('horas_trabalhadas');
     // define the sizes
     $id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $entrada->setSize(50);
     $intervalo_inicio->setSize(50);
     $intervalo_fim->setSize(50);
     $saida->setSize(50);
     $ausencia_id->setSize(40);
     $ausencia_desc->setSize(200);
     $horas_justificadas->setSize(50);
     $justificativa->setSize(200, 50);
     $horas_trabalhadas->setSize(200, 50);
     // outras propriedades
     $id->setEditable(false);
     $servidor_nome->setEditable(false);
     $diames->setMask('dd/mm/yyyy');
     $entrada->setMask('99:99');
     $entrada->setValue('00:00');
     $intervalo_inicio->setMask('99:99');
     $intervalo_inicio->setValue('00:00');
     $intervalo_fim->setMask('99:99');
     $intervalo_fim->setValue('00:00');
     $saida->setMask('99:99');
     $saida->setValue('00:00');
     $ausencia_desc->setEditable(false);
     $horas_justificadas->setMask('99:99');
     $horas_justificadas->setValue('00:00');
     $horas_trabalhadas->setMask('99:99');
     // validations
     $servidor_id->addValidation('Servidor', new TRequiredValidator());
     $servidor_nome->addValidation('Nome', new TRequiredValidator());
     $diames->addValidation('Data', new TRequiredValidator());
     $table_horarios = new TTable();
     $table_horarios->addRowSet(new TLabel('Data ' . ': '), $diames);
     $table_horarios->addRowSet(new TLabel('Entrada ' . ': '), $entrada);
     $table_horarios->addRowSet(new TLabel('Intervalo - Início ' . ': '), $intervalo_inicio);
     $table_horarios->addRowSet(new TLabel('Intervalo - Fim' . ': '), $intervalo_fim);
     $table_horarios->addRowSet(new TLabel('Saída' . ': '), $saida);
     $frame_horarios->add($table_horarios);
     $table_ausencia = new TTable();
     $table_ausencia->addRowSet(new TLabel('Motivo ' . ': '), $ausencia_id);
     $table_ausencia->addRowSet(new TLabel('Descrição ' . ': '), $ausencia_desc);
     $table_ausencia->addRowSet(new TLabel('Horas Justificadas ' . ': '), $horas_justificadas);
     $table_ausencia->addRowSet(new TLabel('Justificativa ' . ': '), $justificativa);
     $frame_ausencia->add($table_ausencia);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRow();
     $cell = $row->addCell($frame_horarios);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_ausencia);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o fa-lg');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('FrequenciaServidorList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue fa-lg');
     // define the form fields
     $this->form->setFields(array($id, $servidor_id, $servidor_nome, $diames, $entrada, $intervalo_inicio, $intervalo_fim, $saida, $ausencia_id, $ausencia_desc, $horas_justificadas, $justificativa, $horas_trabalhadas, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Пример #21
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_search_Book');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Books')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $title = new TEntry('title');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description');
     $title->setValue(TSession::getValue('Book_title'));
     $author_id->setValue(TSession::getValue('Book_author_id'));
     $author_name->setValue(TSession::getValue('Book_author_name'));
     $collection_id->setValue(TSession::getValue('Book_collection_id'));
     $classification_id->setValue(TSession::getValue('Book_classification_id'));
     $author_name->setEditable(FALSE);
     $title->setSize(320);
     $author_id->setSize(100);
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_search_Book');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($title);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addMultiCell($author_id, $author_name);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $cell = $row->addCell($collection_id);
     // add a row for the title field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Classification') . ': '));
     $cell = $row->addCell($classification_id);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('BookForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $table->addRowSet('', array($find_button, $new_button))->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($title, $author_id, $author_name, $collection_id, $classification_id, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(280);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', _t('Code'), 'right', 50);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 200);
     $main_author = new TDataGridColumn('author_name', _t('Author'), 'left', 160);
     $edition = new TDataGridColumn('edition', _t('Edition'), 'left', 50);
     $call = new TDataGridColumn('call_number', _t('Call'), 'left', 80);
     // creates the datagrid actions
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     // define the ordering parameters
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'title');
     // assign the ordering actions
     $id->setAction($order1);
     $title->setAction($order2);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($title);
     $this->datagrid->addColumn($main_author);
     $this->datagrid->addColumn($edition);
     $this->datagrid->addColumn($call);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('BookForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
Пример #22
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 750px';
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_project = new TCombo('id_project');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $register_date = new TDate('register_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $file = new TFile('file');
     $register_date->setValue(date('Y-m-d'));
     $register_date->setMask('yyyy-mm-dd');
     $time->setValue(date('H:i'));
     $id_priority->setValue(2);
     // default
     $description->style = 'margin: 10px';
     TTransaction::open('changeman');
     $member = Member::newFromLogin(TSession::getValue('login'));
     $member_projects = $member->getProjectsList();
     $id_project->addItems($member_projects);
     // if just one project, its the default
     if (count($member_projects) == 1) {
         $project_keys = array_keys($member_projects);
         $id_project->setValue($project_keys[0]);
     }
     TTransaction::close();
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $register_date->setSize(100);
     $file->setSize(250);
     $time->setSize(50);
     $time->setMask('99:99');
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), array($register_date, $time));
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $table2->addRowSet(new TLabel(_t('File') . ':'), $file);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $label_description = new TLabel(_t('Description'));
     $label_description->setFontStyle('b');
     $row = $table->addRow();
     $row->addCell($label_description);
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($id_project, $id_priority, $id_category, $register_date, $time, $title, $file, $description, $save_button));
     // add the form to the page
     parent::add($this->form);
 }