Пример #1
0
 public function __construct()
 {
     parent::__construct();
     // create the notebook
     $this->notebook = new TNotebook(500, 125);
     $this->notebook->setTabsVisibility(FALSE);
     $this->step = new TBreadCrumb();
     $this->step->addItem('Seleção', FALSE);
     $this->step->addItem('Verificação', FALSE);
     $this->step->addItem('Importação', TRUE);
     $this->step->select('Seleção');
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $page1 = new TTable();
     $page2 = new TTable();
     $page3 = new TTable();
     // add the notebook inside the form
     $this->form->add($this->notebook);
     // adds the notebook page
     $this->notebook->appendPage('Seleção', $page1);
     $this->notebook->appendPage('Verificação', $page2);
     $this->notebook->appendPage('Importação', $page3);
     //criar campo da aba selecao
     $file = new TFile('file');
     $file->setProperty("accept", ".xlsx");
     $file->setSize('250px');
     //campos aba verificacao
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     // add the fields into the tables
     $page1->addRowSet(new TLabel('Local do arquivo:'), $file);
     $page2->addRowSet(new TLabel('The name you:'), $field2);
     $page3->addRowSet(new TLabel('The name you typed:'), $field3);
     // creates the action buttons
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onStep2')), 'Next');
     $button1->setImage('ico_next.png');
     $button2 = new TButton('action2');
     $button2->setAction(new TAction(array($this, 'onStep1')), 'Previous');
     $button2->setImage('ico_previous.png');
     $button3 = new TButton('action3');
     $button3->setAction(new TAction(array($this, 'onStep3')), 'Next');
     $button3->setImage('ico_next.png');
     $button4 = new TButton('action4');
     $button4->setAction(new TAction(array($this, 'onStep2')), 'Previous');
     $button4->setImage('ico_previous.png');
     $button5 = new TButton('save');
     $button5->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button5->setImage('ico_save.png');
     $page1->addRowSet($button1);
     $page2->addRowSet($button2, $button3);
     $page3->addRowSet($button4, $button5);
     // define wich are the form fields
     $this->form->setFields(array($file, $field2, $field3, $button1, $button2, $button3, $button4, $button5));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->step);
     $vbox->add($this->form);
     parent::add($vbox);
 }
Пример #2
0
 /**
  * Construtor.
  *
  * @param string $content
  * */
 public function __construct($content = NULL)
 {
     parent::__construct();
     $this->setContent($content);
 }
Пример #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->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);
 }