/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); parent::setTitle('New Window'); parent::setSize(600, 370); parent::setPosition(100, 100); // create the form using TQuickForm class $this->form = new TQuickForm(); // create the notebook $notebook = new TNotebook(530, 260); // adds the notebook page $notebook->appendPage('Quick form component', $this->form); // create the form fields $id = new TEntry('id'); $description = new TEntry('description'); $date = new TDate('date'); $text = new TText('text'); // add the fields inside the form $this->form->addQuickField('Id', $id, 40); $this->form->addQuickField('Description', $description, 200); $this->form->addQuickField('Date', $date, 100); $this->form->addQuickField('Text', $text, 120); // define the form action $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png'); // add the form inside the page parent::add($notebook); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form using TQuickForm class $this->form = new TQuickForm('form_dynamic_filter'); // create the notebook $notebook = new TNotebook(530, 160); // adds the notebook page $notebook->appendPage('Dynamic filtering', $this->form); $check_gender = new TCheckGroup('check_gender'); $check_gender->addItems(array('M' => 'Male', 'F' => 'Female')); $check_gender->setLayout('horizontal'); $combo_status = new TCombo('combo_status'); $combo_status->addItems(array('S' => 'Single', 'C' => 'Committed', 'M' => 'Married')); $combo_customers = new TCombo('customers'); // add the fields inside the form $this->form->addQuickField('Load customers: ', $check_gender, 200); $this->form->addQuickField('', $combo_status, 200); $this->form->addQuickField('', $combo_customers, 200); $check_gender->setChangeAction(new TAction(array($this, 'onGenderChange'))); $combo_status->setChangeAction(new TAction(array($this, 'onGenderChange'))); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(520, 320); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Multi field component', $this->form); // create the form fields $multifield = new TMultiField('contacts'); $multifield->setOrientation('horizontal'); $subfield1 = new TEntry('name'); $subfield2 = new TEntry('phone'); $subfield3 = new TComboCombined('type_id', 'type_value'); $subfield3->addItems(array(1 => 'Cellphone', 2 => 'Landline')); $subfield3->setSize(160); $multifield->setHeight(140); $multifield->addField('name', 'Name', $subfield1, 160, TRUE); $multifield->addField('phone', 'Phone', $subfield2, 120, TRUE); $multifield->addField('type_id', 'Type', $subfield3, 150); $subfield1->setSize(120); $subfield2->setSize(120); // add a row for one field $row = $table->addRow(); $row->addCell($lbl = new TLabel('Multifield object:')); $lbl->setFontStyle('b'); $row = $table->addRow(); $row->addCell($multifield); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // define wich are the form fields $this->form->setFields(array($multifield, $button1)); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * 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); }
/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // define the tree data $data = array(); $data['Brazil']['RS'][10] = 'Lajeado'; $data['Brazil']['RS'][20] = 'Cruzeiro do Sul'; $data['Brazil']['RS'][30] = 'Porto Alegre'; $data['Brazil']['SP'][40] = 'São Paulo'; $data['Brazil']['SP'][50] = 'Osasco'; $data['Brazil']['MG'][60] = 'Belo Horizonte'; $data['Brazil']['MG'][70] = 'Ipatinga'; // scroll around the treeview $scroll = new TScroll(); $scroll->setSize(300, 200); // creates the treeview $treeview = new TTreeView(); $treeview->setSize(300); $treeview->setItemIcon('ico_file.png'); $treeview->setItemAction(new TAction(array($this, 'onSelect'))); $treeview->fromArray($data); // fill the treeview $scroll->add($treeview); // creates a simple form $this->form = new TQuickForm('form_test'); // creates the notebook around the form $notebook = new TNotebook(350, 100); $notebook->appendPage('Quick form component', $this->form); // creates the form fields $key = new TEntry('key'); $value = new TEntry('value'); $this->form->addQuickField('Key', $key, 50); $this->form->addQuickField('Value', $value, 170); // creates a table to wrap the treeview and the form $table = new TTable(); $row = $table->addRow(); $cell = $row->addCell($scroll)->valign = 'top'; $cell = $row->addCell($notebook)->valign = 'top'; // 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(); // create the calendar $this->calendar = new TCalendar(); // Gett actual data $this->calendar->setMonth(date('m')); $this->calendar->setYear(date('Y')); $this->calendar->selectDays(date("j")); $this->calendar->setSize(750, 500); $this->calendar->setAction(new TAction(array($this, 'onSelect'))); // creates a simple form $this->form = new TQuickForm('calendar_helper'); // creates the notebook around the form $notebook = new TNotebook(300, 180); $notebook->appendPage('Calendar Helper', $this->form); // creates the form fields $year = new TEntry('year'); $month = new TEntry('month'); $day = new TEntry('day'); $year->setValue($this->calendar->getYear()); $month->setValue($this->calendar->getMonth()); $day->setValue($this->calendar->getSelectedDays()); $this->form->addQuickField('Year', $year, 100); $this->form->addQuickField('Month', $month, 100); //$this->form->addQuickField('Day', $day, 100); // creates a table to wrap the treeview and the form $table = new TTable(); $this->form->addQuickAction('Back', new TAction(array($this, 'onBack')), 'ico_back.png'); $this->form->addQuickAction('Next', new TAction(array($this, 'onNext')), 'ico_next.png'); $row = $table->addRow(); $cell = $row->addCell($this->calendar)->valign = 'top'; $cell = $row->addCell($notebook)->valign = 'top'; // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($table); parent::add($vbox); }
public function __construct() { // parent classs constructor parent::__construct(); parent::setSize(0.8, 0.8); // label to present the docs $this->label = new TText('name'); $this->label->setSize(690, 130); // notebook to put the scroll inside $note = new TNotebook(700, 150); $note->appendPage('Explanation', $this->label); // scroll to put the source inside $scroll2 = new TScroll(); $scroll2->setSize(700, 250); $this->source = new TSourceCode(); $scroll2->add($this->source); // create a table to organize the layout $page = new TTable(); $row1 = $page->addRow(); $row2 = $page->addRow(); $row1->addCell($note); $row2->addCell($scroll2); parent::add($this->source); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates a notebook $notebook = new TNotebook(500, 250); // creates the notebook page $page = new TTable(); // adds the notebook page $notebook->appendPage('Register data', $page); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TCombo('field4'); $field5 = new TEntry('field5'); $field6 = new TEntry('field6'); $field7 = new TEntry('field7'); $field8 = new TEntry('field8'); $field9 = new TEntry('field9'); // creates an array with items $units = array(); $units['PC'] = 'Piece'; $units['LT'] = 'Liter'; $units['ML'] = 'Milliliter'; $units['GL'] = 'Gallon'; $units['KG'] = 'Kilogram'; $units['GR'] = 'Gram'; // add the items to the combo $field4->addItems($units); // define some sizes $field1->setEditable(FALSE); $field1->setSize(100); $field2->setSize(300); $field4->setSize(100); $field3->setSize(100); $field5->setSize(100); $field6->setSize(100); $field7->setSize(100); $field8->setSize(100); $field9->setSize(300); // add a row for one field $row = $page->addRow(); $row->addCell(new TLabel('Id:')); $cell = $row->addCell($field1); // add a row for one field $row = $page->addRow(); $row->addCell(new TLabel('Description:')); $cell = $row->addCell($field2); // creates a frame $frame = new TFrame(); $frame->oid = 'frame-measures'; $frame->setLegend('Measures'); $button = new TButton('show_hide'); $button->class = 'btn btn-default btn-sm active'; $button->setLabel('Show/hide measures'); $button->addFunction("\$('[oid=frame-measures]').slideToggle(); \$(this).toggleClass( 'active' )"); $row = $page->addRow(); $row->addCell($button); // add the frame inside the table $row = $page->addRow(); $cell = $row->addCell($frame); $cell->colspan = 2; // adds another table inside the frame $page2 = new TTable(); $frame->add($page2); // add a row for tow fields $row = $page2->addRow(); $row->addCell(new TLabel('Stock:')); $row->addCell($field3); $row->addCell(new TLabel('Unit:')); $row->addCell($field4); // add a row for tow fields $row = $page2->addRow(); $row->addCell(new TLabel('Cost Price:')); $row->addCell($field5); $row->addCell(new TLabel('Sell Price:')); $row->addCell($field6); // add a row for tow fields $row = $page2->addRow(); $row->addCell(new TLabel('Net Weight:')); $row->addCell($field7); $row->addCell(new TLabel('Gross Weight:')); $row->addCell($field8); // add just another field $row = $page->addRow(); $row->addCell(new TLabel('Another field:')); $cell = $row->addCell($field9); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * Show the notebook at the screen */ public function show() { // includes the CSS and JavaScript functions to handle notebooks TPage::include_css('lib/adianti/include/tnotebook/tnotebook.css'); TPage::include_js('lib/adianti/include/tnotebook/tnotebook.js'); // count the pages $pages = $this->getPageCount(); // creates a table $note_table = new TTable(); $note_table->{'width'} = $this->width; $note_table->{'border'} = 0; $note_table->{'cellspacing'} = 0; $note_table->{'cellpadding'} = 0; $note_table->{'class'} = 'notebook-table'; // add a row for the tabs $row = $note_table->addRow(); $i = 0; $id = $this->id; // get javascript code to show/hide sub-notebooks $subnotes_hide = $this->_getHideCode(); $subnotes_show = $this->_getShowCode(); if ($this->pages) { // iterate the tabs, showing them foreach ($this->pages as $title => $content) { // verify if the current page is to be shown $classe = $i == $this->currentPage ? 'tnotebook_aba_sim' : 'tnotebook_aba_nao'; // add a cell for this tab if ($this->tabsVisibility) { $cell = $row->addCell(" {$title} "); $cell->{'class'} = $classe; $cell->id = "aba_{$id}_{$i}"; $cell->height = '23px'; $cell->onclick = $subnotes_hide . "tnotebook_hide({$id}, {$pages});" . "tnotebook_show_tab({$id},{$i});" . $this->getShowPageCode($title); // show only this page sub-contents if ($this->tabAction) { $this->tabAction->setParameter('current_page', $i + 1); $string_action = $this->tabAction->serialize(FALSE); $cell->onclick = $cell->onclick . "ajaxExec('{$string_action}')"; } $cell->onmouseover = "javascript:tnotebook_prelight(this, {$id}, {$i})"; $cell->onmouseout = "javascript:tnotebook_unprelight(this, {$id}, {$i})"; // creates the cell spacer $cell = $row->addCell(' '); $cell->{'class'} = 'tnotebook_spacer'; $cell->width = '3px'; $i++; } } } // creates the cell terminator $cell = $row->addCell(' '); $cell->{'class'} = 'tnotebook_end'; if ($this->tabsVisibility) { $row = $note_table->addRow(); $row->height = '7px'; $cell = $row->addCell('<span></span>'); $cell->{'class'} = 'tnotebook_down'; $cell->colspan = 100; } // show the table $note_table->show(); // creates a <div> around the content $quadro = new TElement('div'); $quadro->{'class'} = 'tnotebook_quadro'; $width = $this->width - 7; $quadro->style = "height:{$this->height}px;width:{$width}px"; if ($this->id == 1) { self::$subNotes = $this->_getSubNotes(); } $i = 0; // iterate the tabs again, now to show the content if ($this->pages) { foreach ($this->pages as $title => $content) { // verify if the current page is to be shown if ($i == $this->currentPage and ($this->id == 1 or in_array($this->id, self::$subNotes))) { $classe = 'tnotebook_painel_sim'; } else { $classe = 'tnotebook_painel_nao'; } // creates a <div> for the contents $painel = new TElement('div'); $painel->{'class'} = $classe; // CSS $painel->id = "painel_{$id}_{$i}"; // ID $quadro->add($painel); // check if the content is an object if (is_object($content)) { $painel->add($content); } $i++; } } $quadro_table = new TTable(); $quadro_table->width = $this->width; $quadro_table->{'class'} = 'tnotebook_table'; $quadro_table->border = 0; $quadro_table->cellspacing = 0; $quadro_table->cellpadding = 0; $row = $quadro_table->addRow(); $row->addCell($quadro); $quadro_table->show(); }
/** * 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(); // creates the form $this->form = new TForm('form_Book'); // creates a table $table1 = new TTable(); $table2 = new TTable(); $table3 = new TTable(); $notebook = new TNotebook(550, 400); $notebook->appendPage(_t('Basic data'), $table1); $notebook->appendPage(_t('Secundary data'), $table2); $notebook->appendPage(_t('Items'), $table3); // add the table inside the form $this->form->add($notebook); // create the form fields $id = new TEntry('id'); $title = new TEntry('title'); $isbn = new TEntry('isbn'); $call_number = new TEntry('call_number'); $author_id = new TSeekButton('author_id'); $author_name = new TEntry('author_name'); $edition = new TEntry('edition'); $volume = new TEntry('volume'); $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description'); $classification_id = new TDBCombo('classification_id', 'library', 'Classification', 'id', 'description'); $publisher_id = new TSeekButton('publisher_id'); $publisher_name = new TEntry('publisher_name'); $publish_place = new TEntry('publish_place'); $publish_date = new TDate('publish_date'); $abstract = new TText('abstract'); $notes = new TText('notes'); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Publisher'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'publisher_id'); $action->setParameter('receive_field', 'publisher_name'); $publisher_id->setAction($action); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_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); // define the sizes $id->setSize(100); $title->setSize(340); $isbn->setSize(120); $call_number->setSize(120); $author_id->setSize(100); $edition->setSize(120); $volume->setSize(120); $collection_id->setSize(100); $classification_id->setSize(100); $publisher_id->setSize(100); $publish_place->setSize(140); $publish_date->setSize(100); $abstract->setSize(400, 40); $notes->setSize(400, 40); $id->setEditable(FALSE); $publisher_name->setEditable(FALSE); $author_name->setEditable(FALSE); // add a row for the field id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Code'))); $cell = $row->addCell($id); $cell->colspan = 3; // add a row for the field title $row = $table1->addRow(); $row->addCell(new TLabel(_t('Title'))); $cell = $row->addCell($title); $cell->colspan = 3; // add a row for the field isbn/call_nuber $row = $table1->addRow(); $row->addCell(new TLabel('ISBN' . ': ')); $row->addCell($isbn); $row->addCell(new TLabel(_t('Call'))); $row->addCell($call_number); // add a row for the field author_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Author') . ': ')); $row->addCell($author_id); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($author_name); // add a row for the field edition/volume $row = $table1->addRow(); $row->addCell(new TLabel(_t('Edition') . ': ')); $row->addCell($edition); $row->addCell(new TLabel(_t('Volume') . ': ')); $row->addCell($volume); // add a row for the field collection_id/classification_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Collection') . ': ')); $row->addCell($collection_id); $row->addCell(new TLabel(_t('Classification') . ': ')); $row->addCell($classification_id); // add a row for the field publisher_id $row = $table1->addRow(); $row->addCell(new TLabel(_t('Publisher') . ': ')); $row->addCell($publisher_id); $row->addCell(new TLabel(_t('Name') . ': ')); $row->addCell($publisher_name); // add a row for the field publish_place $row = $table1->addRow(); $row->addCell(new TLabel(_t('Place') . ': ')); $row->addCell($publish_place); $row->addCell(new TLabel(_t('Date') . ': ')); $row->addCell($publish_date); // add a row for the field abstract $row = $table1->addRow(); $row->addCell(new TLabel(_t('Abstract') . ': ')); $cell = $row->addCell($abstract); $cell->colspan = 3; // add a row for the field notes $row = $table1->addRow(); $row->addCell(new TLabel(_t('Notes') . ': ')); $cell = $row->addCell($notes); $cell->colspan = 3; // secundary authors $authors = new TMultiField('author_list'); $sub_author_id = new TSeekButton('id'); $sub_author_name = new TEntry('name'); $sub_author_name->setEditable(FALSE); $sub_author_id->setSize(50); $sub_author_name->setSize(300); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Author'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'author_list_id'); $action->setParameter('receive_field', 'author_list_name'); $sub_author_id->setAction($action); $authors->setHeight(80); $authors->setClass('Author'); $authors->addField('id', _t('Author'), $sub_author_id, 50); $authors->addField('name', _t('Name'), $sub_author_name, 300); $row = $table2->addRow(); $row->addCell($l = new TLabel(_t('Authors'))); $l->setFontStyle('b'); $row = $table2->addRow(); $row->addCell($authors); // secundary subjects $subjects = new TMultiField('subject_list'); $sub_subject_id = new TSeekButton('id'); $sub_subject_name = new TEntry('name'); $sub_subject_name->setEditable(FALSE); $sub_subject_id->setSize(50); $sub_subject_name->setSize(300); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'library'); $action->setParameter('parent', 'form_Book'); $action->setParameter('model', 'Subject'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'subject_list_id'); $action->setParameter('receive_field', 'subject_list_name'); $sub_subject_id->setAction($action); $subjects->setHeight(80); $subjects->setClass('Subject'); $subjects->addField('id', _t('Subject'), $sub_subject_id, 50); $subjects->addField('name', _t('Name'), $sub_subject_name, 300); $row = $table2->addRow(); $row->addCell($l = new TLabel(_t('Subjects'))); $l->setFontStyle('b'); $row = $table2->addRow(); $row->addCell($subjects); // items $items = new TMultiField('item_list'); $item_barcode = new TEntry('barcode'); $item_status_id = new TComboCombined('status_id', 'status_description'); $item_cost = new TEntry('cost'); $item_acquire_date = new TDate('acquire_date'); $item_notes = new TEntry('notes'); $item_status_id->setSize(150); $item_cost->setSize(100); $item_acquire_date->setSize(100); TTransaction::open('library'); $rep = new TRepository('Status'); $objects = $rep->load(new TCriteria()); $options = array(); if ($objects) { foreach ($objects as $object) { $options[$object->id] = $object->description; } } $item_status_id->addItems($options); TTransaction::close(); $items->setHeight(140); $items->setClass('Item'); $items->addField('barcode', _t('Barcode'), $item_barcode, 80); $items->addField('status_id', _t('Status'), $item_status_id, 100); $items->addField('cost', _t('Cost'), $item_cost, 80); $items->addField('acquire_date', _t('Acquire date'), $item_acquire_date, 80); $items->addField('notes', _t('Notes'), $item_notes, 150); $row = $table3->addRow(); $row->addCell($l = new TLabel(_t('Items'))); $l->setFontStyle('b'); $row = $table3->addRow(); $row->addCell($items); // 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 = $table1->addRow(); $row->addCell($save_button); // define wich are the form fields $this->form->setFields(array($id, $title, $isbn, $call_number, $author_id, $author_name, $edition, $volume, $collection_id, $classification_id, $publisher_id, $publisher_name, $publish_place, $publish_date, $abstract, $notes, $authors, $subjects, $items, $save_button)); // add the form to the page parent::add($this->form); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 340); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TPassword('field5'); $field6 = new TDate('field6'); $field7 = new TSpinner('field7'); $field8 = new TSlider('field8'); $field9 = new TText('field9'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field6->setSize(100); $field7->setRange(0, 100, 10); $field8->setRange(0, 100, 10); $field7->setValue(30); $field8->setValue(50); $field9->setSize(300, 50); // add rows for the fields $table->addRowSet(new TLabel('TEntry object:'), $field1); $table->addRowSet(new TLabel('TEntry not editable:'), $field2); $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999')); $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4); $table->addRowSet(new TLabel('TPassword object:'), $field5); $table->addRowSet(new TLabel('TDate Object:'), $field6); $table->addRowSet(new TLabel('Spinner Object:'), $field7); $table->addRowSet(new TLabel('Slider Object:'), $field8); $table->addRowSet(new TLabel('TText Object:'), $field9); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
/** * */ public function makeTNotebook($properties) { $width = (int) $properties->{'width'}; $height = (int) $properties->{'height'} - 30; // correction for sheet tabs $widget = new TNotebook($width, $height); if ($properties->{'pages'}) { foreach ($properties->{'pages'} as $page) { $attributes = $page->attributes(); $name = $attributes['tab']; $class = get_class($this); // for inheritance $panel = new $class((int) $properties->{'width'} - 2, (int) $properties->{'height'} - 23); // pass the controller and form ahead. $panel->setController($this->controller); $panel->setForm($this->form); // parse element $panel->parseElement($page); // integrate the notebook' fields $this->fieldsByName = array_merge((array) $this->fieldsByName, (array) $panel->getWidgets()); $this->fields = array_merge((array) $this->fields, (array) $panel->getFields()); $widget->appendPage((string) $name, $panel); } } $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(620, 410); // create the form $this->form = new TForm(); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Input elements', $this->form); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TEntry('field5'); $field6 = new TPassword('field6'); $field7 = new TDate('field7'); $field8 = new TSpinner('field8'); $field9 = new TSlider('field9'); $field10 = new TText('field10'); $field1->setTip('Tip for field 1'); $field2->setTip('Tip for field 2'); $field3->setTip('Tip for field 3'); $field4->setTip('Tip for field 4'); $field5->setTip('Tip for field 5'); $field6->setTip('Tip for field 6'); $field7->setTip('Tip for field 7'); $field8->setTip('Tip for field 8'); $field9->setTip('Tip for field 9'); $field10->setTip('Tip for field 10'); $field2->setValue('123'); $field2->setEditable(FALSE); $field3->setMask('99.999-999'); $field4->setMaxLength(10); $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin')); $field7->setSize(100); $field8->setRange(0, 100, 10); $field9->setRange(0, 100, 10); $field8->setValue(30); $field9->setValue(50); $field10->setSize(300, 80); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry object:')); $cell = $row->addCell($field1); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry not editable:')); $cell = $row->addCell($field2); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with mask:')); $cell = $row->addCell($field3); $cell = $row->addCell(new TLabel('99.999-999')); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with maxlength (10):')); $cell = $row->addCell($field4); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TEntry with completion (a..):')); $cell = $row->addCell($field5); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TPassword object:')); $cell = $row->addCell($field6); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TDate Object:')); $cell = $row->addCell($field7); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Spinner Object:')); $cell = $row->addCell($field8); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Slider Object:')); $cell = $row->addCell($field9); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('TText Object:')); $cell = $row->addCell($field10); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1)); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // add the form inside the page parent::add($notebook); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Ticket'); $this->form->class = 'tform'; // CSS class $table = new TTable(); $table->style = 'width: 600px'; $tablePagamento = new TTable(); $tablePagamento->style = 'width: 600px'; $notebook = new TNotebook(600, 650); $notebook->appendPage('Ticket - Cadastramento', $table); $notebook->appendPage('Ticket - Orçamento / Pagamento', $tablePagamento); // create the form fields $id = new TEntry('id'); $id->setEditable(FALSE); $titulo = new TEntry('titulo'); $origem = new TCombo('origem'); $combo_origem = array(); $combo_origem['I'] = 'Interno'; $combo_origem['E'] = 'Externo'; $origem->addItems($combo_origem); $origem->setDefaultOption(FALSE); $solicitacao_descricao = new TText('solicitacao_descricao'); $providencia = new TText('providencia'); $orcamento_horas = new TEntry('orcamento_horas'); $orcamento_horas->setMask('999999'); $orcamento_valor_hora = new TEntry('orcamento_valor_hora'); $orcamento_valor_hora->setNumericMask(2, ',', '.'); $valor_desconto = new TEntry('valor_desconto'); $valor_desconto->setNumericMask(2, ',', '.'); $valor_total = new TEntry('valor_total'); $valor_total->setNumericMask(2, ',', '.'); $valor_total->setEditable(FALSE); $forma_pagamento = new TEntry('forma_pagamento'); $data_ultimo_pgto = new TEntry('data_ultimo_pgto'); $data_ultimo_pgto->setEditable(FALSE); $valor_ultimo_pgto = new TEntry('valor_ultimo_pgto'); $valor_ultimo_pgto->setNumericMask(2, ',', '.'); $valor_ultimo_pgto->setEditable(FALSE); $valor_total_pago = new TEntry('valor_total_pago'); $valor_total_pago->setNumericMask(2, ',', '.'); $valor_total_pago->setEditable(FALSE); $data_pagamento = new TDate('data_pagamento'); $data_pagamento->setMask('dd/mm/yyyy'); $valor_pagamento = new TEntry('valor_pagamento'); $valor_pagamento->setNumericMask(2, ',', '.'); $valor_total_parcial = new TEntry('valor_total_parcial'); $valor_total_parcial->setNumericMask(2, ',', '.'); $valor_total_parcial->setEditable(FALSE); $valor_saldo = new TEntry('valor_saldo'); $valor_saldo->setNumericMask(2, ',', '.'); $valor_saldo->setEditable(FALSE); $data_cadastro = new TEntry('data_cadastro'); $data_cadastro->setEditable(FALSE); $data_cadastro->setMask('dd/mm/yyyy'); $data_cadastro->setValue(date('d/m/Y')); $data_inicio = new TDate('data_inicio'); $data_inicio->setMask('dd/mm/yyyy'); $data_inicio_oculta = new THidden('data_inicio_oculta'); $data_cancelamento = new TDate('data_cancelamento'); $data_cancelamento->setMask('dd/mm/yyyy'); $data_encerramento = new TDate('data_encerramento'); $data_encerramento->setMask('dd/mm/yyyy'); $data_prevista = new TDate('data_prevista'); $data_prevista->setMask('dd/mm/yyyy'); $data_aprovacao = new TDate('data_aprovacao'); $data_aprovacao->setMask('dd/mm/yyyy'); $observacao = new TText('observacao'); $nome_dtr = new TEntry('nome_dtr'); $nome_dtr->setEditable(FALSE); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria); $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome'); $tipo_ticket_id->setDefaultOption(FALSE); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome'); $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome'); $status_ticket_id->setValue(2); $status_ticket_id->setEditable(FALSE); $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome'); $prioridade_id->setDefaultOption(FALSE); $prioridade_id->setValue(3); $combo_tipo_origens = new TCombo('tipo_origens'); $combo_tipo_origens->addItems(array(1 => 'Entidade', 2 => 'Estabelecimento', 3 => 'Empresa')); $combo_codigo_origem = new TCombo('codigo_cadastro_origem'); $combo_solicitante_id = new TCombo('solicitante_id'); try { TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); TTransaction::close(); } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // shows the exception error message } $logado_id = new THidden('logado_id'); $logado_id->setValue($logado->pessoa_codigo); // define the sizes $id->setSize(100); $origem->setSize(200); $solicitacao_descricao->setSize(400, 180); $data_inicio->setSize(90); $data_encerramento->setSize(90); $data_cancelamento->setSize(90); $providencia->setSize(400, 80); $orcamento_horas->setSize(100); $orcamento_valor_hora->setSize(100); $valor_desconto->setSize(100); $valor_total->setSize(100); $valor_saldo->setSize(121); $forma_pagamento->setSize(400); $data_ultimo_pgto->setSize(100); $data_pagamento->setSize(100); $valor_pagamento->setSize(121); $valor_ultimo_pgto->setSize(100); $valor_total_pago->setSize(100); $valor_total_parcial->setSize(121); $data_cadastro->setSize(100); $data_prevista->setSize(100); $data_aprovacao->setSize(100); $observacao->setSize(400, 80); $nome_dtr->setSize(400); $titulo->setSize(390); $responsavel_id->setSize(390); $tipo_ticket_id->setSize(200); $sistema_id->setSize(200); $status_ticket_id->setSize(200); $prioridade_id->setSize(200); $combo_tipo_origens->setSize(135); $combo_codigo_origem->setSize(250); $combo_solicitante_id->setSize(390); // validações $titulo->addValidation('Titulo', new TRequiredValidator()); $combo_solicitante_id->addValidation('Solicitante', new TRequiredValidator()); $responsavel_id->addValidation('Responsável', new TRequiredValidator()); $sistema_id->addValidation('Sistema', new TRequiredValidator()); $gerar_dr = TButton::create('gerar_dr', array('RequisitoDesenvolvimentoForm', 'onEdit'), 'Gerar DTR', 'ico_add.png'); $link_dtr = new TButton('link_dtr'); $link_dtr->setImage('bs:edit green'); $link_dtr->setLabel('ir para DTR'); $link_dtr->addFunction("__adianti_load_page('index.php?class=RequisitoDesenvolvimentoForm&method=onBuscaDTR&key={$_REQUEST['key']}');"); $this->form->addField($gerar_dr); $this->form->addField($link_dtr); TButton::disableField('form_Ticket', 'gerar_dr'); TButton::disableField('form_Ticket', 'link_dtr'); // add one row for each form field // notebook Cadastramento $table->addRowSet(new TLabel('Ticket:'), array($id, new TLabel('Data Cadastro'), $data_cadastro)); $table->addRowSet($label_combo_origem = new TLabel('Origem:'), array($combo_tipo_origens, $combo_codigo_origem)); $label_combo_origem->setFontColor('#FF0000'); $table->addRowSet($label_solicitante = new TLabel('Solicitante:'), $combo_solicitante_id); $label_solicitante->setFontColor('#FF0000'); $table->addRowSet($label_responsavel = new TLabel('Responsável:'), $responsavel_id); $label_responsavel->setFontColor('#FF0000'); $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo); $label_titulo->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Data Inicio'), array($data_inicio, $label_status = new TLabel('Status:'), $status_ticket_id)); $label_status->setSize(70); $table->addRowSet(new TLabel('Data Encerramento:'), array($data_encerramento, $label_data_cancelamento = new TLabel('Data Cancelamento:'), $data_cancelamento)); $label_data_cancelamento->setSize(160); $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id); $table->addRowSet(new TLabel('Origem:'), $origem); $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id); $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id); $label_sistema->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Descrição Solicitação:'), $solicitacao_descricao); $table->addRowSet(new TLabel('DR.:'), $nome_dtr); $table->addRowSet(new TLabel(''), array($gerar_dr, $link_dtr)); $table->addRowSet(new TLabel(''), $data_inicio_oculta); // notebook Pagamento $tablePagamento->addRowSet(new TLabel('Data Prevista:'), $data_prevista); $tablePagamento->addRowSet(new TLabel('Data Aprovação:'), $data_aprovacao); $tablePagamento->addRowSet(new TLabel('Qte Horas:'), $orcamento_horas); $tablePagamento->addRowSet(new TLabel('Valor Hora:'), $orcamento_valor_hora); $tablePagamento->addRowSet(new TLabel('Valor Desconto:'), $valor_desconto); $tablePagamento->addRowSet(new TLabel('Valor Total:'), $valor_total); $tablePagamento->addRowSet(new TLabel('Forma de Pgto:'), $forma_pagamento); $tablePagamento->addRowSet(new TLabel('Descrição Providência:'), $providencia); $tablePagamento->addRowSet(new TLabel('Observação:'), $observacao); // creates a frame $frame = new TFrame(); $frame->oid = 'frame-measures'; $frame->setLegend('Pagamentos:'); $row = $tablePagamento->addRow(); $cell = $row->addCell($frame); $cell->colspan = 2; $page2 = new TTable(); $frame->add($page2); $page2->addRowSet(new TLabel('Valor Pgto:'), array($valor_pagamento, $tamanho_label = new TLabel('Valor Ultimo Pgto:'), $valor_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Data Pgto:'), array($data_pagamento, $tamanho_label = new TLabel('Data Ultimo Pgto:'), $data_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Valor Total:'), array($valor_total_parcial, $tamanho_label = new TLabel('Valor Total Pago: '), $valor_total_pago)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Saldo a pagar:'), $valor_saldo); $tablePagamento->addRowSet(new TLabel(''), $logado_id); // Envia campos para o formulario $this->form->setFields(array($id, $titulo, $data_inicio, $data_inicio_oculta, $data_encerramento, $data_cancelamento, $origem, $solicitacao_descricao, $nome_dtr, $providencia, $orcamento_horas, $orcamento_valor_hora, $valor_desconto, $valor_total, $forma_pagamento, $data_ultimo_pgto, $valor_ultimo_pgto, $valor_total_pago, $data_cadastro, $data_prevista, $data_aprovacao, $observacao, $tipo_ticket_id, $sistema_id, $status_ticket_id, $prioridade_id, $responsavel_id, $valor_total_parcial, $valor_pagamento, $data_pagamento, $valor_saldo, $combo_tipo_origens, $combo_codigo_origem, $combo_solicitante_id, $logado_id)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg'); $list_button = TButton::create('list', array('TicketList', 'onReload'), _t('List'), 'fa:table blue'); $enviar_email = TButton::create('email', array($this, 'onEnviaEmail'), 'Enviar Email', 'ico_email.png'); $sincronizar = TButton::create('sincronizar', array($this, 'onSincronizarContatos'), 'Sincronizar Contatos', 'sincronizar.png'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($del_button); $this->form->addField($list_button); $this->form->addField($enviar_email); $this->form->addField($sincronizar); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($save_button); $row->addCell($new_button); $row->addCell($del_button); $row->addCell($list_button); $row->addCell($enviar_email); $row->addCell($sincronizar); $pretable = new TTable(); $pretable->style = 'width: 100%'; $row = $pretable->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de Ticket'))->colspan = 2; $change_action = new TAction(array($this, 'onCalculaValorTotal')); $orcamento_horas->setExitAction($change_action); $orcamento_valor_hora->setExitAction($change_action); $valor_desconto->setExitAction($change_action); $change_data_action = new TAction(array($this, 'onChangeDataAction')); $data_aprovacao->setExitAction($change_data_action); $change_data_prev = new TAction(array($this, 'onChangeDataPrevista')); $data_prevista->setExitAction($change_data_prev); $change_data_pagamento = new TAction(array($this, 'onChangeDataPagamento')); $data_pagamento->setExitAction($change_data_pagamento); $change_valor = new TAction(array($this, 'onCalculaValorParcial')); $valor_pagamento->setExitAction($change_valor); $change_status = new TAction(array($this, 'onChangeDataInicio')); $data_inicio->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataCancelamento')); $data_cancelamento->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataEncerramento')); $data_encerramento->setExitAction($change_status); $change_origem = new TAction(array($this, 'onChangeOrigem')); $combo_tipo_origens->setChangeAction($change_origem); $change_tipo_origem = new TAction(array($this, 'onChangeTipoOrigem')); $combo_codigo_origem->setChangeAction($change_tipo_origem); $vbox = new TVBox(); $vbox->add($pretable); $vbox->add($notebook); $vbox->add($subtable); $this->form->add($vbox); parent::add($this->form); }
/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates the accordion $accordion = new TAccordion(); $accordion->style = "width:550px"; // creates the containers for each accordion page $page1 = new TTable(); $page2 = new TPanel(370, 180); $page3 = new TTable(); // adds two pages in the accordion $accordion->appendPage('Basic data', $page1); $accordion->appendPage('Other data', $page2); $accordion->appendPage('Other note', $page3); // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TEntry('field5'); $field6 = new TEntry('field6'); $field7 = new TEntry('field7'); $field8 = new TEntry('field8'); $field9 = new TEntry('field9'); $field10 = new TEntry('field10'); // change the size for some fields $field1->setSize(100); $field2->setSize(80); $field3->setSize(150); $field6->setSize(80); $field7->setSize(80); $field8->setSize(80); $field9->setSize(80); $field10->setSize(80); ## fields for the page 1 ## // add a row for a label $row = $page1->addRow(); $cell = $row->addCell(new TLabel('<b>Table Layout</b>')); $cell->valign = 'top'; $cell->colspan = 2; // adds a row for a field $row = $page1->addRow(); $row->addCell(new TLabel('Field1:')); $row->addCell($field1); // adds a row for a field $row = $page1->addRow(); $row->addCell(new TLabel('Field2:')); $cell = $row->addCell($field2); $cell->colspan = 3; // adds a row for a field $row = $page1->addRow(); $row->addCell(new TLabel('Field3:')); $cell = $row->addCell($field3); $cell->colspan = 3; // adds a row for a field $row = $page1->addRow(); $row->addCell(new TLabel('Field4:')); $row->addCell($field4); // adds a row for a field $row = $page1->addRow(); $row->addCell(new TLabel('Field5:')); $row->addCell($field5); ## fields for the page 2 ## $page2->put(new TLabel('<b>Panel Layout</b>'), 4, 4); $page2->put(new TLabel('Field6'), 20, 30); $page2->put(new TLabel('Field7'), 50, 60); $page2->put(new TLabel('Field8'), 80, 90); $page2->put(new TLabel('Field9'), 110, 120); $page2->put(new TLabel('Field10'), 140, 150); $page2->put($field6, 120, 30); $page2->put($field7, 150, 60); $page2->put($field8, 180, 90); $page2->put($field9, 210, 120); $page2->put($field10, 240, 150); ## fields for the page 3 ## // creates the notebook $subnotebook = new TNotebook(250, 160); $subnotebook->appendPage('new page1', new TLabel('test1')); $subnotebook->appendPage('new page2', new TText('test2')); $row = $page3->addRow(); $row->addCell($subnotebook); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($accordion); 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('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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the notebook $notebook = new TNotebook(530, 200); // create the form $this->form = new TForm('form_seek_sample'); // creates the notebook page $table = new TTable(); // add the notebook inside the form $this->form->add($table); // adds the notebook page $notebook->appendPage('Seek Button component', $this->form); // create the form fields $city_id1 = new TSeekButton('city_id1'); $city_name1 = new TEntry('city_name1'); $city_id2 = new TSeekButton('city_id2'); $city_name2 = new TEntry('city_name2'); $city_id1->setSize(100); $city_id2->setSize(100); $city_name1->setEditable(FALSE); $city_name2->setEditable(FALSE); $obj = new TestCitySeek(); $action = new TAction(array($obj, 'onReload')); $city_id1->setAction($action); $obj = new TStandardSeek(); $action = new TAction(array($obj, 'onSetup')); $action->setParameter('database', 'samples'); $action->setParameter('parent', 'form_seek_sample'); $action->setParameter('model', 'City'); $action->setParameter('display_field', 'name'); $action->setParameter('receive_key', 'city_id2'); $action->setParameter('receive_field', 'city_name2'); $city_id2->setAction($action); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Manual SeekButton:')); $cell = $row->addCell($city_id1); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('City name:')); $cell = $row->addCell($city_name1); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('Standard SeekButton:')); $cell = $row->addCell($city_id2); // add a row for one field $row = $table->addRow(); $row->addCell(new TLabel('City name:')); $cell = $row->addCell($city_name2); // creates the action button $button1 = new TButton('action1'); // define the button action $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // add a row for the button $row = $table->addRow(); $row->addCell($button1); // define wich are the form fields $this->form->setFields(array($city_id1, $city_name1, $city_id2, $city_name2, $button1)); // add the form inside the page parent::add($notebook); }
/** * 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); }