Ejemplo n.º 1
0
 /**
  * Shows the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the checkgroup options
         foreach ($this->items as $index => $label) {
             // instantiates a new CheckButton
             $button = new TCheckButton("{$this->name}[]");
             $button->setTip($this->tag->title);
             $button->setIndexValue($index);
             $button->setProperty('checkgroup', $this->name);
             // verify if the checkbutton is checked
             if (@in_array($index, $this->value)) {
                 //$button->setProperty('checked', '1');
                 $button->setValue($index);
                 // value=indexvalue (checked)
             }
             // check whether the widget is non-editable
             if (!parent::getEditable()) {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
                 echo "\n";
             }
         }
     }
 }
 /**
  * Class constructor
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_pdf_shapes');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $name->addValidation('Name', new TRequiredValidator());
     $label = new TLabel('Name' . ': ');
     $label->setFontColor('red');
     $table->addRowSet($label, $name);
     $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
     $table->addRowSet($save_button);
     // define wich are the form fields
     $this->form->setFields(array($name, $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);
 }
Ejemplo n.º 3
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the RadioButton options
         foreach ($this->items as $index => $label) {
             $button = new TRadioButton($this->name);
             $button->setTip($this->tag->title);
             $button->setValue($index);
             // check if contains any value
             if ($this->value == $index) {
                 // mark as checked
                 $button->setProperty('checked', '1');
             }
             // check whether the widget is non-editable
             if (!parent::getEditable()) {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }
Ejemplo n.º 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 !== '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_Document');
     $this->form->add($this->notebook);
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Document')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $title = new TEntry('title');
     $content = new THtmlEditor('content');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $title->setSize(200, 40);
     $content->setSize(680, 350);
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Title') . ': '), $title);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($content);
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Content') . ': '));
     $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');
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $title, $content, $save_button));
     $table->addRowSet($save_button, '')->class = 'tformaction';
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Ejemplo n.º 5
0
 public function createLabel($s)
 {
     if ($this->_autoLabel) {
         $label = new TLabel();
         $label->setText($this->_headerText ? $this->_headerText : $this->_dataField);
         $label->setForControl($s);
         $this->getControls()->add($label);
     }
 }
Ejemplo n.º 6
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();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(600, 350);
     $this->notebook->appendPage(_t('Data'), $table);
     // creates the form
     $this->form = new TForm('form_Release');
     $this->form->add($this->notebook);
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TEntry('project');
     $name = new TEntry('name');
     $description = new THtmlEditor('description');
     $id->setEditable(FALSE);
     $id_project->setEditable(FALSE);
     $name->setEditable(FALSE);
     $description->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     // add a row for the field id
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($id);
     // add a row for the field id_project
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($id_project);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($name);
     // 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($description);
     $cell->colspan = 3;
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $name, $description));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * 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);
 }
 /**
  * Open an input dialog
  */
 public function onInputDialog($param)
 {
     $name = new TEntry('name');
     $amount = new TEntry('amount');
     $name->setValue($param['key']);
     $form = new TForm('input_form');
     $form->style = 'padding:20px';
     $table = new TTable();
     $table->addRowSet(new TLabel('Name: '), $name);
     $table->addRowSet($lbl = new TLabel('Amount: '), $amount);
     $lbl->setFontColor('red');
     $form->setFields(array($name, $amount));
     $form->add($table);
     // show the input dialog
     new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm');
 }
Ejemplo n.º 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'));
     }
     // creates the form
     $this->form = new TForm('form_Note');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->addRowSet(new TLabel(_t('Note')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_issue = new THidden('id_issue');
     $note = new THtmlEditor('note');
     // define the sizes
     $id_issue->setSize(100);
     $note->setSize(640, 200);
     $note->style = 'margin: 10px';
     // add a row for the field id_issue
     $row = $table->addRow();
     $row->addCell($id_issue);
     // add a row for the field note
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Notes') . ': '));
     $row = $table->addRow();
     $row->addCell($note);
     $lbl->setFontStyle('b');
     // 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 = $table->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($id_issue, $note, $save_button));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Ejemplo n.º 10
0
 /**
  * Add a form field
  * @param $label     Field Label
  * @param $object    Field Object
  * @param $size      Field Size
  * @param $validator Field Validator
  */
 public function addQuickField($label, IWidget $object, $size = 200, TFieldValidator $validator = NULL)
 {
     $object->setSize($size, $size);
     parent::addField($object);
     // add the field to the container
     $row = $this->table->addRow();
     if ($validator instanceof TRequiredValidator) {
         $label_field = new TLabel($label . '(*)');
         $label_field->setFontColor('#FF0000');
     } else {
         $label_field = new TLabel($label);
     }
     $row->addCell($label_field);
     $row->addCell($object);
     if ($validator) {
         $object->addValidation($label, $validator);
     }
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Multi Cell');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $min = new TEntry('min');
     $max = new TEntry('max');
     $start_date = new TDate('start_date');
     $end_date = new TDate('end_date');
     $address = new TEntry('address');
     // adjust the size of the code
     $id->setSize(70);
     $start_date->setSize(70);
     $end_date->setSize(70);
     $min->setSize(87);
     $max->setSize(87);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     // first approach
     $table->addRowSet(new TLabel('Value'), array($min, new TLabel('To'), $max));
     // second approach
     $row = $table->addRow();
     $row->addCell(new TLabel('Date'));
     $row->addMultiCell($start_date, $end_date);
     $table->addRowSet(new TLabel('Address'), $address);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
Ejemplo n.º 12
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Ponto_report');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->string = new StringsUtil();
     // creates the table container
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('Indicador de produtividade por colaborador'));
     $cell->colspan = 2;
     // create the form fields
     $mes_atividade = new TCombo('mes_atividade');
     $mes_atividade->addItems($this->string->array_meses());
     $mes_atividade->setDefaultOption(FALSE);
     $mes_atividade->setValue(date('m'));
     $mes_atividade->setSize(250);
     $output_type = new TRadioGroup('output_type');
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Saida', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Mês referencia:'), $mes_atividade);
     $table->addRowSet($label_output_type = new TLabel('Saida:'), $output_type);
     $label_output_type->setFontColor('#FF0000');
     $this->form->setFields(array($mes_atividade, $output_type));
     $output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF'));
     $output_type->setValue('html');
     $output_type->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
     $this->form->addField($generate_button);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
Ejemplo n.º 13
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Content');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->setFormTitle(_t('Content'));
     // defines the database
     parent::setDatabase('blog');
     // defines the active record
     parent::setActiveRecord('Content');
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $subtitle = new TText('subtitle');
     $sidepanel = new THtmlEditor('sidepanel');
     $id->setEditable(FALSE);
     // add the fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Title'), $title, 500);
     $this->form->addQuickField(_t('Subtitle'), $subtitle, 400);
     $row = $this->form->getContainer()->addRow();
     $row->addCell($lbl = new TLabel(_t('Side panel')));
     $lbl->setFontStyle('b');
     $sidepanel->style = 'margin: 10px';
     $row = $this->form->getContainer()->addRow();
     $row->addCell($sidepanel)->colspan = 2;
     $this->form->addField($sidepanel);
     $subtitle->setSize(500, 40);
     $sidepanel->setSize(590, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     TTransaction::open('blog');
     $content = new Content();
     if ($content->load(1)) {
         $this->onEdit(array('key' => 1));
     }
     TTransaction::close();
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Columns');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $text = new TText('text');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     $city->addItems($items);
     // adjust the size of the code
     $id->setSize(70);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     $table->addRowSet(new TLabel('City'), $city);
     $table->addRowSet(new TLabel('Address'), $address);
     $table->addRowSet(new TLabel('Telephone'), $telephone);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
Ejemplo n.º 15
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Post');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $this->form->setFormTitle(_t('Post'));
     // defines the database
     parent::setDatabase('blog');
     // defines the active record
     parent::setActiveRecord('Post');
     // create the form fields
     $id = new TEntry('id');
     $title = new TEntry('title');
     $body = new THtmlEditor('body');
     $keywords = new TEntry('keywords');
     $date = new TDate('date');
     $category_id = new TDBCombo('category_id', 'blog', 'Category', 'id', 'name');
     $id->setEditable(FALSE);
     // add the fields
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Title'), $title, 300);
     $this->form->addQuickField(_t('Date'), $date, 80);
     $row = $this->form->getContainer()->addRow();
     $row->addCell($lbl = new TLabel(_t('Post') . ':'));
     $lbl->setFontStyle('b');
     $body->style = 'margin: 10px';
     $row = $this->form->getContainer()->addRow();
     $row->addCell($body)->colspan = 2;
     $this->form->addField($body);
     $this->form->addQuickField(_t('Keywords'), $keywords, 400);
     $this->form->addQuickField(_t('Category'), $category_id, 200);
     $body->setSize(550, 370);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add the form to the page
     parent::add($this->form);
 }
Ejemplo n.º 16
0
 /**
  * método show()
  * exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new TCheckButton("{$this->name}[]");
             $button->setValue($index);
             // verifica se deve ser marcado
             if (@in_array($index, $this->value)) {
                 $button->setProperty('checked', '1');
             }
             $button->show();
             $obj = new TLabel($label);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new TElement('br');
                 $br->show();
                 echo "\n";
             }
         }
     }
 }
Ejemplo n.º 17
0
 /**
  * método show()
  * exibe o widget na tela
  */
 public function show()
 {
     if ($this->items) {
         // percorre cada uma das opções do rádio
         foreach ($this->items as $index => $label) {
             $button = new TRadioButton($this->name);
             $button->setValue($index);
             // se possui qualquer valor
             if ($this->value == $index) {
                 // marca o radio button
                 $button->setProperty('checked', '1');
             }
             $button->show();
             $obj = new TLabel($label);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // exibe uma tag de quebra de linha
                 $br = new TElement('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }
Ejemplo n.º 18
0
 /**
  * 
  */
 public function makeTLabel($properties)
 {
     $widget = new TLabel((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setFontColor((string) $properties->{'color'});
     $widget->setFontSize((string) $properties->{'size'});
     $widget->setFontStyle((string) $properties->{'style'});
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
Ejemplo n.º 19
0
 /** Gets TLabelMeaning object by property $property_name with value $property_value.
  * @return TLabelMeaning or NULL in case of error
  */
 public static function getLabelMeaning($property_name, $property_value, $meaning_obj = NULL)
 {
     global $LINK_DB;
     $query = "SELECT * FROM label_meaning WHERE `{$property_name}`='{$property_value}'";
     $result = $LINK_DB->query_e($query, "Query failed in " . __METHOD__ . " in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
     if ($LINK_DB->query_count($result) == 0) {
         return NULL;
     }
     $labelMeaning_arr = array();
     while ($row = $result->fetch_object()) {
         /*
         	    if ($meaning_obj == NULL)
         	  	$meaning_obj = TMeaning::getByID($row->meaning_id);
         */
         $labelMeaning_arr[] = new TLabelMeaning(TLabel::getByID($row->label_id), $meaning_obj);
     }
     return $labelMeaning_arr;
 }
Ejemplo n.º 20
0
 /**
  * Add a field to the MultiField
  * @param $name   Widget's name
  * @param $text   Widget's label
  * @param $object Widget
  * @param $size   Widget's size
  * @param $inform Show the Widget in the form
  */
 public function addField($name, $text, GtkObject $object, $size, $mandatory = FALSE)
 {
     if ($this->orientation == 'horizontal') {
         if (count($this->fields) == 0) {
             $this->row_label = $this->table_fields->addRow();
             $this->row_field = $this->table_fields->addRow();
         }
     } else {
         $row = $this->table_fields->addRow();
         $this->row_label = $row;
         $this->row_field = $row;
     }
     $label = new TLabel("<i>{$text}</i>");
     if ($mandatory) {
         $label->setFontColor('#FF0000');
     }
     $n = $this->count;
     $object->setName("{$this->name}_text{$n}");
     $this->row_label->addCell($label);
     $this->row_field->addCell($object);
     $this->fields[$name] = array($text, $object, $size, FALSE, $mandatory);
     $this->allfields[$name] = array($text, $object, $size, FALSE, $mandatory);
     if (get_class($object) == 'TComboCombined') {
         $column = new GtkTreeViewColumn('ID');
     } else {
         $column = new GtkTreeViewColumn($text);
     }
     $cell_renderer = new GtkCellRendererText();
     $cell_renderer->set_property('width', $size);
     $column->set_fixed_width($size);
     $column->pack_start($cell_renderer, true);
     $column->add_attribute($cell_renderer, 'text', $this->count);
     $this->types[] = GObject::TYPE_STRING;
     $this->view->append_column($column);
     $this->columns[$name] = $this->count;
     $this->count++;
     // combocombined, need to add one more column and treat different
     if (get_class($object) == 'TComboCombined') {
         $cell_renderer->set_property('width', 20);
         $column->set_fixed_width(20);
         $tname = $object->getTextName();
         $this->fields[$tname] = array($text, $object, $size, TRUE, $mandatory);
         $this->fields[$name][2] = 20;
         $this->allfields[$name][2] = 20;
         $column = new GtkTreeViewColumn($text);
         $cell_renderer = new GtkCellRendererText();
         $cell_renderer->set_property('width', $size);
         $column->set_fixed_width($size);
         $column->pack_start($cell_renderer, true);
         $column->add_attribute($cell_renderer, 'text', $this->count);
         $this->types[] = GObject::TYPE_STRING;
         $this->view->append_column($column);
         $this->allfields[$tname] = array($text, $object, $size, TRUE, $mandatory);
         $this->columns[$tname] = $this->count;
         $this->count++;
     }
 }
Ejemplo n.º 21
0
 /**
  * Creates a pager button.
  * Override parent implementation to create, depending on the button type, a TActiveLinkButton,
  * a TActiveButton or a TActiveImageButton may be created.
  * 
  * @param string button type, either LinkButton or PushButton
  * @param boolean whether the button should be enabled
  * @param string caption of the button
  * @param string CommandName corresponding to the OnCommand event of the button
  * @param string CommandParameter corresponding to the OnCommand event of the button
  * @return mixed the button instance
  */
 protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
 {
     if ($buttonType === TPagerButtonType::LinkButton) {
         if ($enabled) {
             $button = new TActiveLinkButton();
         } else {
             $button = new TLabel();
             $button->setText($text);
             return $button;
         }
     } else {
         if ($buttonType === TPagerButtonType::ImageButton) {
             $button = new TActiveImageButton();
             $button->setImageUrl($this->getPageImageUrl($text, $commandName));
             if ($enabled) {
                 $button->Visible = true;
             } else {
                 $button->Visible = false;
             }
         } else {
             $button = new TActiveButton();
             if (!$enabled) {
                 $button->setEnabled(false);
             }
         }
     }
     if ($buttonType === TPagerButtonType::ImageButton) {
         $button->ImageUrl = $text;
     }
     $button->setText($text);
     $button->setCommandName($commandName);
     $button->setCommandParameter($commandParameter);
     $button->setCausesValidation(false);
     $button->attachEventHandler('OnCallback', array($this, 'handleCallback'));
     $button->getAdapter()->getBaseActiveControl()->setClientSide($this->getClientSide());
     return $button;
 }
Ejemplo n.º 22
0
 /**
  * Renders the body content enclosed between the control tag.
  * By default, child controls and text strings will be rendered.
  * You can override this method to provide customized content rendering.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function renderContents($writer)
 {
     $writer->renderBeginTag('center');
     $writer->addAttribute('class', 'field');
     $writer->renderBeginTag('div');
     $writer->renderBeginTag('table');
     $writer->renderBeginTag('tr');
     $writer->renderBeginTag('td');
     $startTimeLabel = new TLabel();
     $startTimeLabel->setText(Prado::localize("Start time"));
     $this->addedControl($startTimeLabel);
     $startTimeLabel->render($writer);
     $writer->renderEndTag();
     $writer->renderBeginTag('td');
     $this->startTime->render($writer);
     $writer->renderEndTag();
     $writer->renderBeginTag('td');
     $endTimeLabel = new TLabel();
     $endTimeLabel->setText(Prado::localize("End time"));
     $this->addedControl($endTimeLabel);
     $endTimeLabel->render($writer);
     $writer->renderEndTag();
     $writer->renderBeginTag('td');
     $this->endTime->render($writer);
     $writer->renderEndTag();
     if ($this->getPlannerType() == 'Access') {
         $writer->renderBeginTag('td');
         $pincodeLabel = new TLabel();
         $pincodeLabel->setText(Prado::localize("Pin Code necessary"));
         $this->addedControl($pincodeLabel);
         $pincodeLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->pinCode->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $exitingOnlyLabel = new TLabel();
         $exitingOnlyLabel->setText(Prado::localize("Exiting only"));
         $this->addedControl($exitingOnlyLabel);
         $exitingOnlyLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->exitingOnly->render($writer);
         $writer->renderEndTag();
     } else {
         $writer->renderBeginTag('td');
         $unlockingLabel = new TLabel();
         $unlockingLabel->setText(Prado::localize("Unlocking"));
         $this->addedControl($unlockingLabel);
         $unlockingLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->unlocking->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $supOpenTooLongAlarmLabel = new TLabel();
         $supOpenTooLongAlarmLabel->setText(Prado::localize("Sup. 'door open too long alarm'"));
         $this->addedControl($supOpenTooLongAlarmLabel);
         $supOpenTooLongAlarmLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->supOpenTooLongAlarm->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $supWithoutPermAlarmLabel = new TLabel();
         $supWithoutPermAlarmLabel->setText(Prado::localize("Sup. 'open without permission alarm'"));
         $this->addedControl($supWithoutPermAlarmLabel);
         $supWithoutPermAlarmLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->supWithoutPermAlarm->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $checkOnlyCompanyIDLabel = new TLabel();
         $checkOnlyCompanyIDLabel->setText(Prado::localize("Check only company ID"));
         $this->addedControl($checkOnlyCompanyIDLabel);
         $checkOnlyCompanyIDLabel->render($writer);
         $writer->renderEndTag();
         $writer->renderBeginTag('td');
         $this->checkOnlyCompanyID->render($writer);
         $writer->renderEndTag();
     }
     $writer->renderBeginTag('td');
     $specialRelayPlanLabel = new TLabel();
     $specialRelayPlanLabel->setText(Prado::localize("Use special relay plan"));
     $this->addedControl($specialRelayPlanLabel);
     $specialRelayPlanLabel->render($writer);
     $writer->renderEndTag();
     $writer->renderBeginTag('td');
     $this->specialRelayPlan->render($writer);
     $writer->renderEndTag();
     $writer->renderEndTag();
     $writer->renderEndTag();
     $writer->renderEndTag();
     $writer->renderEndTag();
     $arrDays = $this->getDayNames();
     $date = mktime($this->getStartHourOfWeek(), 0, 0, 5, 5, 2006);
     $suffix = "00";
     // Enable this line in case you want to show hours like 08:00 - 23:00
     $writer->addAttribute('id', 'weekScheduler_top');
     $writer->renderBeginTag('div');
     $writer->addAttribute('class', 'spacer');
     $writer->renderBeginTag('div');
     $writer->renderBeginTag('span');
     $writer->renderEndTag();
     $writer->renderEndTag();
     $writer->addAttribute('id', 'weekScheduler_dayRow');
     $writer->addAttribute('class', 'days');
     $writer->renderBeginTag('div');
     foreach ($arrDays as $name) {
         $writer->renderBeginTag('div');
         $writer->write($name);
         $writer->renderBeginTag('span');
         $writer->renderEndTag();
         $writer->renderEndTag();
     }
     $writer->renderEndTag();
     $writer->renderEndTag();
     $writer->addAttribute('id', 'weekScheduler_content');
     $writer->renderBeginTag('div');
     $writer->addAttribute('id', 'weekScheduler_hours');
     $writer->renderBeginTag('div');
     for ($no = $this->getStartHourOfWeek(); $no <= $this->getEndHourOfWeek(); $no++) {
         $suffix = date("a", $date);
         $hour = date("g", $date);
         $hour = $no . ":00";
         $writer->addAttribute('class', 'calendarContentTime');
         $writer->renderBeginTag('div');
         $writer->write($hour);
         /*$writer->addAttribute('class','content_hour');
         		$writer->renderBeginTag('span');
         			$writer->write($suffix);
         		$writer->renderEndTag();*/
         $writer->renderEndTag();
         $date = $date + 3600;
     }
     $writer->renderEndTag();
     $writer->addAttribute('id', 'weekScheduler_appointments');
     $writer->renderBeginTag('div');
     // Looping through the days of a week
     for ($no = 0; $no < 7; $no++) {
         $writer->addAttribute('class', 'weekScheduler_appointments_day');
         $writer->renderBeginTag('div');
         for ($no2 = $this->getStartHourOfWeek(); $no2 <= $this->getEndHourOfWeek(); $no2++) {
             $writer->addAttribute('id', "weekScheduler_appointment_hour" . $no . "_" . $no2);
             $writer->addAttribute('class', 'weekScheduler_appointmentHour');
             $writer->renderBeginTag('div');
             $writer->renderEndTag();
         }
         $writer->renderEndTag();
     }
     $writer->renderEndTag();
     $writer->renderEndTag();
 }
 /**
  * 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('db_crmbf');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('db_crmbf');
     // defines the active record
     parent::setActiveRecord('RegistroTipo');
     // creates the form
     $this->form = new TQuickForm('form_Registro');
     $titulo = new TLabel('Cadastrar Tipo Registro');
     $titulo->setFontColor('red');
     $titulo->setFontSize(16);
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField('', $titulo, 100);
     $this->form->addQuickField('Code', $id, 100);
     $this->form->addQuickField('Nome', $nome, 200);
     // define the form action
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', 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', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('Nome', 'nome', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'nome'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction('Edit', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction('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 table
     $table = new TTable();
     // add a row to the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // add a row to the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // add a row for page navigation
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
Ejemplo n.º 24
0
* Design e Layout
*/
function __autoload($classe)
{
    if (file_exists("../app.widgets/{$classe}.class.php")) {
        include_once "../app.widgets/{$classe}.class.php";
    }
}
//Cria o Formulario
$form = new TForm('formPessoas');
//Cria um Painel
$painel = new TPanel('440', '200');
//Adicona o Painel ao Formulario
$form->add($painel);
//Cria um rotulo de texto para o Titulo
$titulo = new TLabel('Exemplo');
$titulo->setFontFace('Arial');
$titulo->setFontColor('#ff0000');
$titulo->setFontSize('18');
//Posiciona o titulo no Painel
$painel->put($titulo, '120', '4');
$imagem = new TImage('../app.images/mouse.png');
//Posiciona a imagem no painel
$painel->put($imagem, '320', '120');
//Cria uma serie de Campos de entrada de dados
$codigo = new TEntry('codigo');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$telefone = new TEntry('telefone');
$cidade = new TCombo('cidade');
$itens = array();
Ejemplo n.º 25
0
 /**
  * Creates a pager button.
  * Depending on the button type, a TLinkButton or a TButton may be created.
  * If it is enabled (clickable), its command name and parameter will also be set.
  * Derived classes may override this method to create additional types of buttons, such as TImageButton.
  * @param string button type, either LinkButton or PushButton
  * @param boolean whether the button should be enabled
  * @param string caption of the button.
  * @param string CommandName corresponding to the OnCommand event of the button.
  * @param string CommandParameter corresponding to the OnCommand event of the button
  * @return mixed the button instance
  */
 protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
 {
     if ($buttonType === TPagerButtonType::LinkButton) {
         if ($enabled) {
             $button = new TLinkButton();
         } else {
             $button = new TLabel();
             $button->setText($text);
             return $button;
         }
     } else {
         if ($buttonType === TPagerButtonType::ImageButton) {
             $button = new TImageButton();
             $button->setImageUrl($this->getPageImageUrl($text, $commandName));
         } else {
             $button = new TButton();
         }
         if (!$enabled) {
             $button->setEnabled(false);
         }
     }
     $button->setText($text);
     $button->setCommandName($commandName);
     $button->setCommandParameter($commandParameter);
     $button->setCausesValidation(false);
     return $button;
 }
Ejemplo n.º 26
0
 /**
  * Creates a pager button.
  * Depending on the button type, a TLinkButton or a TButton may be created.
  * If it is enabled (clickable), its command name and parameter will also be set.
  * Derived classes may override this method to create additional types of buttons, such as TImageButton.
  * @param mixed the container pager instance of TActiveDatagridPager 
  * @param string button type, either LinkButton or PushButton
  * @param boolean whether the button should be enabled
  * @param string caption of the button
  * @param string CommandName corresponding to the OnCommand event of the button
  * @param string CommandParameter corresponding to the OnCommand event of the button
  * @return mixed the button instance
  */
 protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter)
 {
     if ($buttonType === TDataGridPagerButtonType::LinkButton) {
         if ($enabled) {
             $button = new TLinkButton();
         } else {
             $button = new TLabel();
             $button->setText($text);
             return $button;
         }
     } else {
         $button = new TButton();
         if (!$enabled) {
             $button->setEnabled(false);
         }
     }
     $button->setText($text);
     $button->setCommandName($commandName);
     $button->setCommandParameter($commandParameter);
     $button->setCausesValidation(false);
     return $button;
 }
Ejemplo n.º 27
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 !== '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);
 }
Ejemplo n.º 28
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);
 }
Ejemplo n.º 29
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     if ($this->items) {
         // iterate the RadioButton options
         foreach ($this->items as $index => $label) {
             $button = new TRadioButton($this->name);
             $button->setTip($this->tag->title);
             $button->setValue($index);
             // check if contains any value
             if ($this->value == $index) {
                 // mark as checked
                 $button->setProperty('checked', '1');
             }
             // check whether the widget is non-editable
             if (parent::getEditable()) {
                 if (isset($this->changeAction)) {
                     if (!TForm::getFormByName($this->formName) instanceof TForm) {
                         throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
                     }
                     $string_action = $this->changeAction->serialize(FALSE);
                     $button->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n                                                          ajaxLookup('{$string_action}&'+serialform, this)");
                 }
             } else {
                 $button->setEditable(FALSE);
             }
             // create the label for the button
             $obj = new TLabel($label);
             $obj->add($button);
             $obj->show();
             if ($this->layout == 'vertical') {
                 // shows a line break
                 $br = new TElement('br');
                 $br->show();
             }
             echo "\n";
         }
     }
 }
Ejemplo n.º 30
0
 /** Gets TLabel object by ID
  * @return TLabel or NULL in case of error
  */
 public static function getByID($_id)
 {
     $label_arr = TLabel::getLabel("id", $_id);
     return $label_arr[0];
 }