/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Classification');
     // creates the form
     $this->form = new TQuickForm('form_Classification');
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField(_t('Code'), $id, 100);
     $this->form->addQuickField(_t('Description'), $description, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn(_t('Code'), 'id', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Description'), 'description', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'description'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     // add a row to the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // add a row to the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // add a row for page navigation
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase("app");
     parent::setActiveRecord("TipoMaterialPermanente");
     parent::setDefaultOrder("nome", "asc");
     // creates the form
     $this->form = new TQuickForm('form_TipoMaterialPermanente');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Tipo de material permanente');
     // define the form title
     //
     // create the form fields
     $id = new TEntry('id');
     $id->setEditable(false);
     $nome = new TEntry('nome');
     $nome->addValidation('Tipo do material permanente', new TRequiredValidator());
     $custo = new TEntry('custo');
     $custo->addValidation('Custo', new TRequiredValidator());
     $custo->addValidation('Custo unitário', new TNumericValidator());
     // add the fields
     $this->form->addQuickField('#', $id, 50);
     $this->form->addQuickField('Tipo de material permanente', $nome, 400);
     $this->form->addQuickField('Custo unitário', $custo, 100);
     // create the form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction('Relatório', new TAction(array($this, 'onReport')), 'ico_print.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('#', 'id', 'left', 50);
     $nome = $this->datagrid->addQuickColumn('Tipo de material permanente', 'nome', 'left', 600);
     $custo = $this->datagrid->addQuickColumn('Custo unitário', 'custo', 'right', 100);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, '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());
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('changeman');
     // defines the active record
     parent::setActiveRecord('Category');
     // creates the form
     $this->form = new TQuickForm('form_Category');
     $this->form->setFormTitle(_t('Category'));
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     // define the sizes
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Description') . ': ', $description, 200);
     $id->setEditable(FALSE);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('ID', 'id', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Description'), 'description', 'left', 480, new TAction(array($this, 'onReload')), array('order', 'description'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('app');
     // defines the database
     parent::setActiveRecord('Ajuda');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     // creates the form
     $this->form = new TQuickForm('form_Ajuda');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Ajuda');
     // define the form title
     // create the form fields
     $id = new TEntry('id');
     $id->setEditable(false);
     $titulo = new TEntry('titulo');
     $texto = new THtmlEditor('texto');
     // add the fields
     $this->form->addQuickField('id', $id, 100);
     $this->form->addQuickField('titulo', $titulo, 700);
     $this->form->addQuickField('texto', $texto, 700);
     $texto->setSize(700, 300);
     // create the form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('#', 'id', 'left', 100);
     $texto = $this->datagrid->addQuickColumn('Ajuda', 'titulo', 'left', 640);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, '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());
     // create the page container
     $container = TVBox::pack($this->datagrid, $this->pageNavigation, $this->form);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // define the database
     parent::setDatabase('samples');
     // define the Active Record
     parent::setActiveRecord('Category');
     // define the default order
     parent::setDefaultOrder('id', 'asc');
     // turn off limit for datagrid
     $this->setLimit(-1);
     // create the form
     $this->form = new TQuickForm('form_categories');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->form->setFormTitle('Form/Datagrid');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $name->addValidation(_t('Name'), new TRequiredValidator());
     // add the form fields
     $this->form->addQuickField('ID', $id, 40);
     $this->form->addQuickField('Name', $name, 200);
     // define the form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // make id not editable
     $id->setEditable(FALSE);
     // create the datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // add the columns
     $this->datagrid->addQuickColumn('ID', 'id', 'center', 50, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'name'));
     // add the actions
     $this->datagrid->addQuickAction('Editar', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // wrap objects inside a table
     $table = new TTable();
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     // pack the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // defines the database
     parent::setDatabase('blog');
     // defines the active record
     parent::setActiveRecord('Category');
     // creates the form
     $this->form = new TQuickForm('form_Category');
     $this->form->setFormTitle(_t('Categories'));
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     // add the fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Name'), $name, 200);
     $id->setEditable(FALSE);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('ID', 'id', 'left', 100);
     $name = $this->datagrid->addQuickColumn(_t('Name'), 'name', 'left', 440);
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('samples');
     parent::setActiveRecord('Backlog');
     $this->form = new TQuickForm('form_Backlog');
     // create the form fields
     $id = new TEntry('id');
     $this->project = new TEntry('project');
     $description = new TEntry('description');
     $estimate = new TSlider('estimate');
     $priority = new TCombo('priority');
     $status = new TCombo('status');
     // add the fields
     $this->form->addQuickField('Project', $this->project, 100);
     $this->form->addQuickField('Item Id', $id, 100);
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Estimate', $estimate, 200);
     $this->form->addQuickField('Priority', $priority, 200);
     $this->form->addQuickField('Status', $status, 200);
     $this->project->setEditable(FALSE);
     $this->project->setSize(400);
     $this->project->setValue(TSession::getValue('project_name'));
     $this->project->style = 'font-weight: bold; color: darkblue';
     $description->style = 'color: red';
     $id->setEditable(FALSE);
     $estimate->setRange(1, 100, 1);
     $priority->addItems(array('L' => 'Low', 'M' => 'Medium', 'H' => 'Hight'));
     $status->addItems(array('R' => 'Requested', 'A' => 'Aproved', 'I' => 'Implemented'));
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back'), new TAction(array('ProjectListView', 'onReload')), 'ico_back.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(120);
     $this->datagrid->makeScrollable();
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'left', 80);
     $description = $this->datagrid->addQuickColumn('description', 'description', 'left', 200);
     $estimate = $this->datagrid->addQuickColumn('estimate', 'estimate', 'left', 100);
     $status = $this->datagrid->addQuickColumn('status', 'status', 'left', 100);
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a table
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // creates the notebook
     $this->notebook = new TNotebook();
     $this->notebook->setSize(600, 430);
     $this->notebook->appendPage('Project Backlog', $table);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'ProjectListView'));
     $vbox->add($this->notebook);
     parent::add($vbox);
 }
 /**
  * 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('db_crmbf');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('db_crmbf');
     // defines the active record
     parent::setActiveRecord('RegistroTipo');
     // creates the form
     $this->form = new TQuickForm('form_Registro');
     $titulo = new TLabel('Cadastrar Tipo Registro');
     $titulo->setFontColor('red');
     $titulo->setFontSize(16);
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField('', $titulo, 100);
     $this->form->addQuickField('Code', $id, 100);
     $this->form->addQuickField('Nome', $nome, 200);
     // define the form action
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('ID', 'id', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'nome'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction('Edit', new TDataGridAction(array($this, '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();
     // add a row to the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // add a row to the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // add a row for page navigation
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }