Ejemplo n.º 1
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.º 2
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);
 }
Ejemplo n.º 3
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;
 }
 /**
  * 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);
 }
Ejemplo n.º 5
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.º 6
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);
 }
Ejemplo n.º 7
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.º 8
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);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_customer');
     // creates a table
     $table_data = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Registration Data', $table_data);
     $notebook->appendPage('Contact (composition)', $table_contact);
     $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $phone = new TEntry('phone');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $birthdate = new TDate('birthdate');
     $email = new TEntry('email');
     $gender = new TRadioGroup('gender');
     $status = new TCombo('status');
     $contacts_list = new TMultiField('contacts_list');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     // add field validators
     $name->addValidation('Name', new TRequiredValidator());
     $city_id->addValidation('City', new TRequiredValidator());
     $birthdate->addValidation('Birthdate', new TRequiredValidator());
     $category_id->addValidation('Category', new TRequiredValidator());
     $obj = new CitySeek();
     $city_id->setAction(new TAction(array($obj, 'onReload')));
     $itemGender = array();
     $itemGender['M'] = 'Male';
     $itemGender['F'] = 'Female';
     // add the combo options
     $gender->addItems($itemGender);
     $gender->setLayout('horizontal');
     $itemStatus = array();
     $itemStatus['S'] = 'Single';
     $itemStatus['C'] = 'Committed';
     $itemStatus['M'] = 'Married';
     $status->addItems($itemStatus);
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $city_id->setSize(100);
     $city_name->setSize(150);
     $city_name->setEditable(FALSE);
     $name->setSize(320);
     $address->setSize(320);
     $phone->setSize(120);
     $email->setSize(160);
     $birthdate->setSize(90);
     $status->setSize(120);
     $category_id->setSize(120);
     // add a row for the field code
     $table_data->addRowSet(new TLabel('Code:'), $code);
     $table_data->addRowSet(new TLabel('Name:'), $name);
     $table_data->addRowSet(new TLabel('Address:'), $address);
     $table_data->addRowSet(new TLabel('City:'), array($city_id, new TLabel('Name:'), $city_name));
     $table_data->addRowSet(new TLabel('Phone:'), array($phone, new TLabel('BirthDate:'), $birthdate));
     $table_data->addRowSet(new TLabel('Status:'), array($status, new TLabel('Email:'), $email));
     $table_data->addRowSet(new TLabel('Category:'), array($category_id, new TLabel('Gender:'), $gender));
     $row = $table_contact->addRow();
     $cell = $row->addCell(new TLabel('<b>Contact</b>'));
     $cell->valign = 'top';
     // add two fields inside the multifield in the second sheet
     $contacts_list->setHeight(100);
     $contacts_list->setClass('Contact');
     // define the returning class
     $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
     $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
     $row = $table_contact->addRow();
     $row->addCell($contacts_list);
     // create the radio button for the skills list
     $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
     $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
     $table_skill->addRow()->addCell($skill_list);
     $lbl->setFontStyle('b');
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('CustomerDataGridView', 'onReload')), 'Go to Listing');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $name, $address, $phone, $city_id, $city_name, $birthdate, $email, $gender, $status, $category_id, $contacts_list, $skill_list, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     // wrap the page content
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'CustomerDataGridView'));
     $vbox->add($this->form);
     $vbox->add($subtable);
     // add the form inside the page
     parent::add($vbox);
 }
Ejemplo n.º 10
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 !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(500, 190);
     // creates the form
     $this->form = new TForm('form_Book_Report');
     $this->notebook->appendPage(_t('Data'), $this->form);
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $title = new TEntry('title');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $output_type = new TRadioGroup('output_type');
     $options = array();
     $options['pdf'] = 'PDF';
     $options['rtf'] = 'RTF';
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book_Report');
     $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
     $title->setSize(200);
     $author_id->setSize(100);
     $collection_id->setSize(100);
     $author_name->setEditable(FALSE);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell($l = new TLabel(_t('Report filters')));
     $l->setFontStyle('b');
     // add a row for the field title
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($title);
     $cell->colspan = 2;
     // add a row for the field author_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addCell($author_id);
     $row->addCell($author_name);
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $cell = $row->addCell($collection_id);
     $cell->colspan = 2;
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Output') . ': '));
     $cell = $row->addCell($output_type);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('generate');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate'));
     $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($title, $author_id, $author_name, $collection_id, $output_type, $save_button));
     // add the form to the page
     parent::add($this->notebook);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a panel
     $panel = new TPanel(480, 260);
     if (PHP_SAPI !== 'cli') {
         $panel->style = "background-image: url(app/images/background.png);";
     }
     // creates a label with the title
     $titulo = new TLabel('Panel Layout');
     $titulo->setFontSize(18);
     $titulo->setFontFace('Arial');
     $titulo->setFontColor('red');
     // put the title label in the panel
     $panel->put($titulo, 120, 4);
     $imagem = new TImage('app/images/mouse.png');
     // put the image in the panel
     $panel->put($imagem, 260, 140);
     // create the input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     // add the options to the combo
     $city->addItems($items);
     // adjust the size of the fields
     $id->setSize(70);
     $name->setSize(140);
     $address->setSize(140);
     $telephone->setSize(140);
     $city->setSize(140);
     // create the labels
     $label1 = new TLabel('Code');
     $label2 = new TLabel('Name');
     $label3 = new TLabel('City');
     $label4 = new TLabel('Address');
     $label5 = new TLabel('Telephone');
     // put the widgets in the panel
     $panel->put($label1, 10, 40);
     $panel->put($id, 10, 60);
     $panel->put($label2, 30, 90);
     $panel->put($name, 40, 110);
     $panel->put($label3, 100, 140);
     $panel->put($city, 100, 160);
     $panel->put($label4, 230, 40);
     $panel->put($address, 230, 60);
     $panel->put($label5, 200, 90);
     $panel->put($telephone, 200, 110);
     if (PHP_SAPI !== 'cli') {
         $label6 = new TLabel('Obs');
         $label6->setFontStyle('b');
         $label6->setValue('PS: The panel background is just for understanding purposes.');
         $panel->put($label6, 2, 237);
     }
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($panel);
     parent::add($vbox);
 }
Ejemplo n.º 12
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();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Member');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->add($table);
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Members')), '')->class = 'tformtitle';
     $row = $table->addRow();
     $row->addCell($table1);
     $cell = $row->addCell($table2);
     $cell->valign = 'top';
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $id_role = new TDBCombo('id_role', 'changeman', 'Role', 'id', 'description');
     $login = new TEntry('login');
     $password = new TPassword('password');
     $email = new TEntry('email');
     $active = new TCombo('active');
     $projects = new TDBCheckGroup('project_ids', 'changeman', 'Project', 'id', 'description');
     $id->setEditable(FALSE);
     $active->addItems($options);
     // define the sizes
     $id->setSize(100);
     $name->setSize(200, 40);
     $id_role->setSize(160);
     $login->setSize(200, 40);
     $password->setSize(200, 40);
     $email->setSize(200, 40);
     $active->setSize(200);
     // add a row for the field id
     $row = $table1->addRow();
     $cell = $row->addCell(new TLabel('ID:'));
     $cell->width = '100px';
     $row->addCell($id);
     // add a row for the field name
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($name);
     // add a row for the field id_role
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Role') . ': '));
     $row->addCell($id_role);
     // add a row for the field login
     $row = $table1->addRow();
     $row->addCell(new TLabel('Login:'******'Password') . ': '));
     $row->addCell($password);
     // add a row for the field email
     $row = $table1->addRow();
     $row->addCell(new TLabel('Email:'));
     $row->addCell($email);
     // add a row for the field active
     $row = $table1->addRow();
     $row->addCell(new TLabel(_t('Active') . ': '));
     $row->addCell($active);
     // add a row for the field projects
     $row = $table2->addRow();
     $cell = $row->addCell($lbl_pro = new TLabel(_t('Projects') . ': '));
     $row = $table2->addRow();
     $row->addCell($projects);
     $lbl_pro->setFontStyle('b');
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $row = $table->addRow();
     $row->class = 'tformaction';
     $row->addCell($save_button)->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $id_role, $login, $password, $email, $active, $projects, $save_button));
     $container = new TVBox();
     $container->add($this->form);
     parent::add($container);
 }
Ejemplo n.º 13
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_Release');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->add($table);
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Release')), '')->class = 'tformtitle';
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $name = new TEntry('name');
     $sendmail = new TRadioGroup('sendmail');
     $description = new THtmlEditor('description');
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     $sendmail->addItems($options);
     $sendmail->setLayout('horizontal');
     $sendmail->setValue('N');
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     $table->addRowSet(new TLabel(_t('Send e-mail') . ': '), $sendmail);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($description);
     // 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($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_project, $name, $description, $sendmail, $save_button));
     // 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 Layout');
     $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 two sub-tables
     $table1 = new TTable();
     $table2 = new TTable();
     $table->border = '1';
     $table->cellpadding = '4';
     $table->style = 'border-collapse:collapse;';
     $table1->border = '1';
     $table1->cellpadding = '2';
     $table1->style = 'border-collapse:collapse; border-color: red';
     $table2->border = '1';
     $table2->cellpadding = '2';
     $table2->style = 'border-collapse:collapse; border-color: blue';
     // 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 fields
     $id->setSize(70);
     $name->setSize(140);
     $address->setSize(140);
     $telephone->setSize(140);
     $city->setSize(140);
     $text->setSize(400, 100);
     // creates a series of labels
     $label1 = new TLabel('Code');
     $label2 = new TLabel('Name');
     $label3 = new TLabel('City');
     $label4 = new TLabel('Address');
     $label5 = new TLabel('Telephone');
     // adds a row for the code field
     $row = $table1->addRow();
     $row->addCell($label1);
     $row->addCell($id);
     // adds a row for the name field
     $row = $table1->addRow();
     $row->addCell($label2);
     $row->addCell($name);
     // adds a row for the city field
     $row = $table1->addRow();
     $row->addCell($label3);
     $row->addCell($city);
     // adds a row for the address field
     $row = $table2->addRow();
     $row->addCell($label4);
     $row->addCell($address);
     // adds a row for the phone field
     $row = $table2->addRow();
     $row->addCell($label5);
     $row->addCell($telephone);
     // adds the tables side by side
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $row = $table->addRow();
     $cell = $row->addCell($text);
     $cell->colspan = 2;
     $label6 = new TLabel('Obs');
     $label6->setFontStyle('b');
     $label6->setValue('PS: The table borders are just for understanding purposes.');
     $row = $table->addRow();
     $cell = $row->addCell($label6);
     $cell->colspan = 2;
     // 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();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 750px';
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_project = new TCombo('id_project');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $register_date = new TDate('register_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $file = new TFile('file');
     $register_date->setValue(date('Y-m-d'));
     $register_date->setMask('yyyy-mm-dd');
     $time->setValue(date('H:i'));
     $id_priority->setValue(2);
     // default
     $description->style = 'margin: 10px';
     TTransaction::open('changeman');
     $member = Member::newFromLogin(TSession::getValue('login'));
     $member_projects = $member->getProjectsList();
     $id_project->addItems($member_projects);
     // if just one project, its the default
     if (count($member_projects) == 1) {
         $project_keys = array_keys($member_projects);
         $id_project->setValue($project_keys[0]);
     }
     TTransaction::close();
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $register_date->setSize(100);
     $file->setSize(250);
     $time->setSize(50);
     $time->setMask('99:99');
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), array($register_date, $time));
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $table2->addRowSet(new TLabel(_t('File') . ':'), $file);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $label_description = new TLabel(_t('Description'));
     $label_description->setFontStyle('b');
     $row = $table->addRow();
     $row->addCell($label_description);
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($id_project, $id_priority, $id_category, $register_date, $time, $title, $file, $description, $save_button));
     // add the form to the page
     parent::add($this->form);
 }