function onStep2()
 {
     try {
         $data = $this->form->getData();
         $this->form->validate();
         $page2 = new TTable();
         $this->notebook->appendPage('Page 2', $page2);
         $gender_options = array('M' => 'Male', 'F' => 'Female');
         $ocupation_optins = array('S' => 'Self employed', 'B' => 'Business', 'R' => 'Retired');
         switch ($data->field1) {
             case 'combo':
                 $field3 = new TCombo('field3');
                 break;
             case 'radio':
                 $field3 = new TRadioGroup('field3');
                 $field3->setLayout('horizontal');
                 break;
             case 'check':
                 $field3 = new TCheckGroup('field3');
                 $field3->setLayout('horizontal');
                 break;
         }
         $field3->addValidation('Field 3', new TRequiredValidator());
         switch ($data->field2) {
             case '1':
                 $label = 'Gender';
                 $field3->addItems($gender_options);
                 break;
             case '2':
                 $label = 'Ocupation';
                 $field3->addItems($ocupation_optins);
                 break;
         }
         $field4 = new TEntry('field4');
         $field4->addValidation('Field 4', new TRequiredValidator());
         // add a row for one field
         $row = $page2->addRow();
         $row->addCell($l3 = new TLabel($label . ':'));
         $cell = $row->addCell($field3);
         // add a row for one field
         $row = $page2->addRow();
         $row->addCell($l4 = new TLabel('Next tab title:'));
         $cell = $row->addCell($field4);
         $l3->setFontColor('#FF0000');
         $l4->setFontColor('#FF0000');
         // creates the action button
         $button2 = new TButton('action2');
         $button2->setAction(new TAction(array($this, 'onStep3')), 'Next');
         $button2->setImage('ico_next.png');
         $row = $page2->addRow();
         $row->addCell($button2);
         $this->form->addField($field3);
         $this->form->addField($field4);
         $this->form->addField($button2);
         $this->notebook->setCurrentPage(1);
         $this->form->setData($data);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Customer_Report');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TDBSeekButton('city_id', 'samples', 'form_Customer_Report', 'City', 'name', 'city_id', 'city_name');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     $output_type = new TRadioGroup('output_type');
     $options = array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF');
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRowSet(new TLabel('Report filters'), '');
     $row->class = 'tformtitle';
     // CSS class
     // add the fields into the table
     $table->addRowSet(new TLabel('Name' . ': '), $name);
     $table->addRowSet(new TLabel('City' . ': '), array($city_id, $city_name));
     $table->addRowSet(new TLabel('Category' . ': '), $category_id);
     $table->addRowSet(new TLabel('Output' . ': '), $output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TQuickForm('form_enable_disable');
     $this->form->setFormTitle('Enable/disable');
     $this->form->class = 'tform';
     // create the form fields
     $radio_enable = new TRadioGroup('enable');
     $radio_enable->addItems(array('1' => 'Enable group 1', '2' => 'Enable group 2'));
     $radio_enable->setLayout('horizontal');
     $radio_enable->setValue(1);
     $block1_combo = new TCombo('block1_combo');
     $block1_entry = new TEntry('block1_entry');
     $block1_spinner = new TSpinner('block1_spinner');
     $block2_date = new TDate('block2_date');
     $block2_entry = new TEntry('block2_entry');
     $block2_check = new TCheckGroup('block2_check');
     $block1_combo->addItems(array(1 => 'One', 2 => 'Two'));
     $block1_spinner->setRange(1, 100, 10);
     $block2_check->addItems(array('Y' => 'Yes', 'N' => 'No'));
     // add the fields inside the form
     $this->form->addQuickField('', $radio_enable, 200);
     $this->form->addQuickField('group #1', $block1_combo, 200);
     $this->form->addQuickField('', $block1_entry, 200);
     $this->form->addQuickField('', $block1_spinner, 200);
     $this->form->addQuickField('group #2', $block2_date, 80);
     $this->form->addQuickField('', $block2_entry, 200);
     $this->form->addQuickField('', $block2_check, 200);
     $radio_enable->setChangeAction(new TAction(array($this, 'onChangeRadio')));
     self::onChangeRadio(array('enable' => 1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
// define tamanho para campo código
$codigo->setSize(100);
// define como somente leitura
$codigo->setEditable(FALSE);
// cria um vetor com as opções de sexo
$items = array();
$items['M'] = 'Masculino';
$items['F'] = 'Feminino';
// define tamanho para campo data de nascimento
$datanasc->setSize(100);
// adiciona as opções ao radio button
$sexo->addItems($items);
// define a opção ativa
$sexo->setValue('M');
// define a posição dos elementos
$sexo->setLayout('horizontal');
// cria um vetor com as opções de idiomas
$items = array();
$items['E'] = 'Inglês';
$items['S'] = 'Espanhol';
$items['I'] = 'Italiano';
$items['F'] = 'Francês';
// adiciona as opções ao check button
$linguas->addItems($items);
// define as opções ativas
$linguas->setValue(array('E', 'I'));
// define um valor padrão para o campo
$qualifica->setValue('<digite suas qualificações aqui>');
$qualifica->setSize(240);
// adiciona uma linha para o campo código na tabela
$row = $table->addRow();
Пример #5
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('matricula');
     $this->form->class = 'tform';
     $this->form->setFormTitle('Formulário de matrícula');
     $nome = new TEntry('nome');
     $cpf = new TEntry('cpf');
     $date = new TDate('date');
     $date->setMask('dd/mm/yyyy');
     $telefone = new TEntry('telefone1');
     $telefone->setMask('(99) 9999-999');
     $telefone2 = new TEntry('telefone2');
     $telefone2->setMask('(99) 99999-999');
     $email = new TEntry('email');
     $escolaOrigem = new TEntry('escolaDeOrigem');
     $tipoSanguineo = new TCombo('tipoSanguineo');
     $alergia = new TRadioGroup('alergia');
     $alergia->setLayout('horizontal');
     $descAlergia = new TText('descAlergia');
     $descAlergia->setSize(450, 100);
     TText::disableField('matricula', 'descAlergia');
     $combo_items = array();
     $combo_items['A+'] = 'A+';
     $combo_items['A-'] = 'A-';
     $combo_items['B+'] = 'B+';
     $combo_items['B-'] = 'B-';
     $combo_items['O+'] = 'O+';
     $combo_items['O-'] = 'O-';
     $combo_items['AB+'] = 'AB+';
     $combo_items['AB-'] = 'AB-';
     $tipoSanguineo->addItems($combo_items);
     $combo_items = array();
     $combo_items[1] = 'Sim';
     $combo_items[2] = 'Não';
     $alergia->addItems($combo_items);
     $this->form->addQuickField('Nome', $nome, 559);
     $this->form->addQuickFields('CPF', array($cpf, new TLabel('Data de Nascimento'), $date));
     $this->form->addQuickFields('Telefone', array($telefone, new TLabel('Celular'), $telefone2));
     $this->form->addQuickField('Email', $email, 250);
     $this->form->addQuickField('Escola de Origem', $escolaOrigem, 400);
     $row = $this->form->addRow();
     $row->addCell(' ');
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Informações médicas');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $this->form->addQuickField('Tipo sanguíneo', $tipoSanguineo, 100);
     $this->form->addQuickField('Alergia?', $alergia, 200);
     //$this->form->addQuickField('',$descAlergia,450);
     $row = $this->form->addRow();
     $row->addCell('');
     $row->addCell($descAlergia);
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Dados cadastrais da Mãe');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $nomeMae = new TEntry('nomeMae');
     $telMae = new TEntry('TelMae');
     $telMae->setMask('(99) 99999-999');
     $telMae2 = new Tentry('TelMae2');
     $telMae2->setMask('(99) 99999-999');
     $emailMae = new TEntry('emailMae');
     $this->form->addQuickField('Nome', $nomeMae, 559);
     $this->form->addQuickFields('Telefone', array($telMae, new TLabel('Tel. Alternativo'), $telMae2));
     $this->form->addQuickField('Email', $emailMae, 559);
     $row = $this->form->addRow();
     $row->addCell(' ');
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Dados cadastrais do Pai');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $nomePai = new TEntry('nomePai');
     $telPai = new TEntry('TelPai');
     $telPai->setMask('(99) 99999-999');
     $telPai2 = new Tentry('TelPai2');
     $telPai2->setMask('(99) 99999-999');
     $emailPai = new TEntry('emailPai');
     $this->form->addQuickField('Nome', $nomePai, 559);
     $this->form->addQuickFields('Telefone', array($telPai, new TLabel('Tel. Alternativo'), $telPai2));
     $this->form->addQuickField('Email', $emailPai, 559);
     $row = $this->form->addRow();
     $thidden = new TLabel('');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $alergia->setChangeAction(new TAction(array($this, 'onChangeRadio')));
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     parent::add($this->form);
 }
Пример #6
0
 /**
  * 
  */
 public function makeTRadioGroup($properties)
 {
     $widget = new TRadioGroup((string) $properties->{'name'});
     $widget->setLayout('vertical');
     $pieces = explode("\n", (string) $properties->{'items'});
     $items = array();
     if ($pieces) {
         foreach ($pieces as $line) {
             $part = explode(':', $line);
             $items[$part[0]] = $part[1];
         }
     }
     $widget->addItems($items);
     $widget->setValue((string) $properties->{'value'});
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
Пример #7
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('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_Member_Report');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Report filters')), '')->class = 'tformtitle';
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'library', 'Category', 'id', 'description');
     $output_type = new TRadioGroup('output_type');
     $options = array();
     $options['pdf'] = 'PDF';
     $options['rtf'] = 'RTF';
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Member_Report');
     $action->setParameter('model', 'City');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'city_id');
     $action->setParameter('receive_field', 'city_name');
     $city_id->setAction($action);
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $cell = $row->addCell($name);
     // add a row for the field city_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('City') . ': '));
     $row->addMultiCell($city_id, $city_name);
     // add a row for the field category_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Category') . ': '));
     $cell = $row->addCell($category_id);
     // add a row for the field category_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Output') . ': '));
     $cell = $row->addCell($output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     $vbox = new TVBox();
     $vbox->add($this->form);
     // add the form to the page
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_customer');
     // creates a table
     $table_data = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Registration Data', $table_data);
     $notebook->appendPage('Contact (composition)', $table_contact);
     $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $phone = new TEntry('phone');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $birthdate = new TDate('birthdate');
     $email = new TEntry('email');
     $gender = new TRadioGroup('gender');
     $status = new TCombo('status');
     $contacts_list = new TMultiField('contacts_list');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     // add field validators
     $name->addValidation('Name', new TRequiredValidator());
     $city_id->addValidation('City', new TRequiredValidator());
     $birthdate->addValidation('Birthdate', new TRequiredValidator());
     $category_id->addValidation('Category', new TRequiredValidator());
     $obj = new CitySeek();
     $city_id->setAction(new TAction(array($obj, 'onReload')));
     $itemGender = array();
     $itemGender['M'] = 'Male';
     $itemGender['F'] = 'Female';
     // add the combo options
     $gender->addItems($itemGender);
     $gender->setLayout('horizontal');
     $itemStatus = array();
     $itemStatus['S'] = 'Single';
     $itemStatus['C'] = 'Committed';
     $itemStatus['M'] = 'Married';
     $status->addItems($itemStatus);
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $city_id->setSize(100);
     $city_name->setSize(150);
     $city_name->setEditable(FALSE);
     $name->setSize(320);
     $address->setSize(320);
     $phone->setSize(120);
     $email->setSize(160);
     $birthdate->setSize(90);
     $status->setSize(120);
     $category_id->setSize(120);
     // add a row for the field code
     $table_data->addRowSet(new TLabel('Code:'), $code);
     $table_data->addRowSet(new TLabel('Name:'), $name);
     $table_data->addRowSet(new TLabel('Address:'), $address);
     $table_data->addRowSet(new TLabel('City:'), array($city_id, new TLabel('Name:'), $city_name));
     $table_data->addRowSet(new TLabel('Phone:'), array($phone, new TLabel('BirthDate:'), $birthdate));
     $table_data->addRowSet(new TLabel('Status:'), array($status, new TLabel('Email:'), $email));
     $table_data->addRowSet(new TLabel('Category:'), array($category_id, new TLabel('Gender:'), $gender));
     $row = $table_contact->addRow();
     $cell = $row->addCell(new TLabel('<b>Contact</b>'));
     $cell->valign = 'top';
     // add two fields inside the multifield in the second sheet
     $contacts_list->setHeight(100);
     $contacts_list->setClass('Contact');
     // define the returning class
     $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
     $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
     $row = $table_contact->addRow();
     $row->addCell($contacts_list);
     // create the radio button for the skills list
     $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
     $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
     $table_skill->addRow()->addCell($skill_list);
     $lbl->setFontStyle('b');
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('CustomerDataGridView', 'onReload')), 'Go to Listing');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $name, $address, $phone, $city_id, $city_name, $birthdate, $email, $gender, $status, $category_id, $contacts_list, $skill_list, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     // wrap the page content
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'CustomerDataGridView'));
     $vbox->add($this->form);
     $vbox->add($subtable);
     // add the form inside the page
     parent::add($vbox);
 }
Пример #9
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('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(500, 190);
     // creates the form
     $this->form = new TForm('form_Book_Report');
     $this->notebook->appendPage(_t('Data'), $this->form);
     // creates a table
     $table = new TTable();
     // 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');
     $output_type = new TRadioGroup('output_type');
     $options = array();
     $options['pdf'] = 'PDF';
     $options['rtf'] = 'RTF';
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book_Report');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // define the sizes
     $title->setSize(200);
     $author_id->setSize(100);
     $collection_id->setSize(100);
     $author_name->setEditable(FALSE);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell($l = new TLabel(_t('Report filters')));
     $l->setFontStyle('b');
     // add a row for the field title
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($title);
     $cell->colspan = 2;
     // add a row for the field author_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addCell($author_id);
     $row->addCell($author_name);
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $cell = $row->addCell($collection_id);
     $cell->colspan = 2;
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Output') . ': '));
     $cell = $row->addCell($output_type);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('generate');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate'));
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($title, $author_id, $author_name, $collection_id, $output_type, $save_button));
     // add the form to the page
     parent::add($this->notebook);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Manual selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $search->setMinLength(3);
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(160);
     $select->setSize(200, 70);
     // open database transaction
     TTransaction::open('samples');
     // items repository
     $repository = new TRepository('Category');
     // load all objects
     $collection = $repository->load(new TCriteria());
     // add the combo items
     $items = array();
     foreach ($collection as $object) {
         $items[$object->id] = $object->name;
     }
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     TTransaction::close();
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
Пример #11
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 !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('changeman');
     // defines the active record
     parent::setActiveRecord('Status');
     // creates the form
     $this->form = new TQuickForm('form_Status');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->setFormTitle(_t('Status'));
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $final_state = new TRadioGroup('final_state');
     $id->setEditable(FALSE);
     $final_state->addItems($options);
     $final_state->setLayout('horizontal');
     // define the sizes
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Description') . ': ', $description, 200);
     $this->form->addQuickField(_t('Final state') . ': ', $final_state, 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('ID', 'id', 'left', 70, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Description'), 'description', 'left', 300, new TAction(array($this, 'onReload')), array('order', 'description'));
     $this->datagrid->addQuickColumn(_t('Final state'), 'final_state', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'final_state'));
     // 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
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Static selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(100);
     $select->setSize(200, 70);
     $search->setSize(300, 70);
     $items = array();
     $items['a'] = 'Item a';
     $items['b'] = 'Item b';
     $items['c'] = 'Item c';
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     foreach ($radio->getLabels() as $key => $label) {
         $label->setTip("Radio {$key}");
     }
     foreach ($check->getLabels() as $key => $label) {
         $label->setTip("Check {$key}");
     }
     // define default values
     $search->setMinLength(3);
     $radio->setValue('a');
     $check->setValue(array('a', 'c'));
     $combo->setValue('b');
     $select->setValue(array('b', 'c'));
     $search->setValue(array('b' => 'Item b'));
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
Пример #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 !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Release');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->add($table);
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Release')), '')->class = 'tformtitle';
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $name = new TEntry('name');
     $sendmail = new TRadioGroup('sendmail');
     $description = new THtmlEditor('description');
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     $sendmail->addItems($options);
     $sendmail->setLayout('horizontal');
     $sendmail->setValue('N');
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     $table->addRowSet(new TLabel(_t('Send e-mail') . ': '), $sendmail);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($description);
     // add a row for the field description
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Description') . ': '));
     $lbl->setFontStyle('b');
     $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_project, $name, $description, $sendmail, $save_button));
     // add the form to the page
     parent::add($this->form);
 }