/** * Constructor method */ public function __construct() { parent::__construct('search_box'); $this->form = new TForm('search_box'); $input = new TMultiSearch('input'); $input->setSize(240, 28); $input->addItems($this->getPrograms()); $input->setMinLength(1); $input->setMaxSize(1); $input->setChangeAction(new TAction(array('SearchBox', 'loadProgram'))); $this->form->add($input); $this->form->setFields(array($input)); parent::add($this->form); }
/** * Constructor method */ public function __construct() { parent::__construct('serach_box'); $this->form = new TForm('search_box'); $table = new TTable(); $table->style = 'float:right'; $row = $table->addRow(); $input = new TMultiSearch('input'); $input->setSize(240, 28); $input->addItems($this->getPrograms()); $input->setMinLength(1); $input->setMaxSize(1); $button = new TButton('search'); $button->style = 'margin-top:0px; height:30px;'; $button->setImage('bs:search green'); $button->setAction(new TAction(array($this, 'loadProgram'))); $this->form->setFields(array($input, $button)); $row->addCell($input); $row->addCell($button); $this->form->add($table); parent::add($this->form); }
/** * 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); }
/** * 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); }