コード例 #1
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_login');
     // cria um notebook
     $notebook = new TNotebook();
     $notebook->setSize(340, 130);
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     $langs = array();
     $langs['pt'] = 'Portugues';
     $langs['en'] = 'English';
     // cria os campos do formulário
     $user = new TEntry('user');
     $pass = new TPassword('password');
     $lang = new TCombo('language');
     $lang->addItems($langs);
     $lang->setValue(TSession::getValue('language'));
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Login') . ':'));
     $row->addCell($user);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Password') . ':'));
     $row->addCell($pass);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Language') . ':'));
     $row->addCell($lang);
     // cria um botão de ação (salvar)
     $save_button = new TButton('login');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell($save_button);
     // define quais são os campos do formulário
     $this->form->setFields(array($user, $pass, $lang, $save_button));
     $notebook->appendPage(_t('Data'), $this->form);
     // adiciona o notebook à página
     parent::add($notebook);
 }
コード例 #2
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     $notebook1 = new TNotebook();
     $notebook2 = new TNotebook();
     $notebook1->appendPage('page1', new TLabel('Page 1'));
     $notebook1->appendPage('page2', new TLabel('Page 2'));
     $notebook2->appendPage('page1', new TLabel('Page 1'));
     $notebook2->appendPage('page2', new TLabel('Page 2'));
     $notebook1->setSize(200, 100);
     $notebook2->setSize(200, 100);
     // creates the vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook1);
     $vbox->add($notebook2);
     parent::add($vbox);
 }
コード例 #3
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);
 }
コード例 #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'));
     }
     // 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);
 }