/** * 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(); // creates the form $this->form = new TForm('form_Member'); try { // TUIBuilder object $ui = new TUIBuilder(500, 500); $ui->setController($this); $ui->setForm($this->form); // reads the xml form $ui->parseFile('app/forms/member.form.xml'); $ui->getWidget('code_label')->setValue(_t('Code')); $ui->getWidget('name_label')->setValue(_t('Name')); $ui->getWidget('address_label')->setValue(_t('Address')); $ui->getWidget('city_label')->setValue(_t('City')); $ui->getWidget('category_label')->setValue(_t('Category')); $ui->getWidget('birthdate_label')->setValue(_t('Birthdate')); $ui->getWidget('phone_label')->setValue(_t('Phone')); $ui->getWidget('email_label')->setValue(_t('Email')); $ui->getWidget('login_label')->setValue(_t('Login')); $ui->getWidget('password_label')->setValue(_t('Password')); $ui->getWidget('registration_label')->setValue(_t('Registration')); $ui->getWidget('expiration_label')->setValue(_t('Expiration')); $ui->getWidget('new_button')->setLabel(_t('New')); $ui->getWidget('save_button')->setLabel(_t('Save')); // get the interface widgets $fields = $ui->getWidgets(); // look for the TDataGrid object foreach ($fields as $name => $field) { if ($field instanceof TDataGrid) { $this->datagrid = $field; $this->pageNavigation = $this->datagrid->getPageNavigation(); } } // add the TUIBuilder panel inside the TForm object $this->form->add($ui); // set form fields from interface fields $this->form->setFields($ui->getFields()); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } // add the form to the page parent::add($this->form); }
/** * 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(); // creates the form $this->form = new TForm('form_Loan'); try { // TUIBuilder object $ui = new TUIBuilder(500, 500); $ui->setController($this); $ui->setForm($this->form); // reads the xml form $ui->parseFile('app/forms/checkout.form.xml'); $ui->getWidget('member_label')->setValue(_t('Member')); $ui->getWidget('barcode_label')->setValue(_t('Barcode')); $ui->getWidget('add_button')->setLabel(_t('Add')); $ui->getWidget('apply_button')->setLabel(_t('Apply')); $ui->getWidget('barcode')->setLabel(_t('Barcode')); $ui->getWidget('book_title')->setLabel(_t('Title')); // get the interface widgets $fields = $ui->getWidgets(); // look for the TDataGrid object foreach ($fields as $name => $field) { if ($field instanceof TDataGrid) { $this->datagrid = $field; $this->pageNavigation = $this->datagrid->getPageNavigation(); } } $item_barcode = $ui->getWidget('barcode_input'); $obj = new ItemSeek(); $action = new TAction(array($obj, 'onReload')); $item_barcode->setAction($action); // add the TUIBuilder panel inside the TForm object $this->form->add($ui); // set form fields from interface fields $this->form->setFields($ui->getFields()); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } // add the form to the page parent::add($this->form); }