Ejemplo n.º 1
0
 /**
  * Constructor method
  */
 function __construct($e)
 {
     $error_array = $e->getTrace();
     $table = new TTable();
     $row = $table->addRow();
     $row->addCell('<b>Error: ' . $e->getMessage() . '</b><br>');
     $row = $table->addRow();
     $row->addCell('&nbsp;');
     foreach ($error_array as $error) {
         $file = isset($error['file']) ? $error['file'] : '';
         $line = isset($error['line']) ? $error['line'] : '';
         $file = str_replace(PATH, '', $file);
         $row = $table->addRow();
         $row->addCell('File: ' . $file . ' : ' . $line);
         $row = $table->addRow();
         $args = array();
         if ($error['args']) {
             foreach ($error['args'] as $arg) {
                 if (is_object($arg)) {
                     $args[] = get_class($arg) . ' object';
                 } else {
                     if (is_array($arg)) {
                         $array_param = array();
                         foreach ($arg as $value) {
                             if (is_object($value)) {
                                 $array_param[] = get_class($value);
                             } else {
                                 if (is_array($value)) {
                                     $array_param[] = 'array';
                                 } else {
                                     $array_param[] = $value;
                                 }
                             }
                         }
                         $args[] = implode(',', $array_param);
                     } else {
                         $args[] = (string) $arg;
                     }
                 }
             }
         }
         $class = isset($error['class']) ? $error['class'] : '';
         $type = isset($error['type']) ? $error['type'] : '';
         $row->addCell('&nbsp;&nbsp;<i>' . '<font color=green>' . $class . '</font>' . '<font color=olive>' . $type . '</font>' . '<font color=darkblue>' . $error['function'] . '</font>' . '(' . '<font color=maroon>' . implode(',', $args) . '</font>' . ')</i>');
     }
     $scroll = new TScroll();
     $scroll->setSize(690, 390);
     $scroll->add($table);
     ob_start();
     $table->show();
     $content = ob_get_clean();
     new TMessage('error', $content);
 }
Ejemplo n.º 2
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // Cria o form
     $this->form = new TForm('form_Usuario');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle';
     // adiciona a tabela no form
     $this->form->add($table);
     $frame_grupos = new TFrame(NULL, 280);
     $frame_grupos->setLegend('Grupos');
     $frame_grupos->style .= ';margin: 4px';
     $frame_funcionalidades = new TFrame(NULL, 280);
     $frame_funcionalidades->setLegend('Funcionalidades');
     $frame_funcionalidades->style .= ';margin: 15px';
     // cria os campos de pesquisa do form
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $prontuario = new TEntry('prontuario');
     $password = new TPassword('senha');
     $repassword = new TPassword('resenha');
     $email = new TEntry('email');
     $multifield_funcionalidades = new TMultiField('funcionalidades');
     $funcionalidade_id = new TDBSeekButton('funcionalidade_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'funcionalidades_id', 'funcionalidades_nome');
     $funcionalidade_nome = new TEntry('funcionalidade_nome');
     $grupos = new TDBCheckGroup('grupos', 'saciq', 'Grupo', 'id', 'nome');
     //$frontpage_id        = new TDBSeekButton('frontpage_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'frontpage_id', 'frontpage_nome');
     //$frontpage_nome      = new TEntry('frontpage_nome');
     $scroll = new TScroll();
     $scroll->setSize(290, 230);
     $scroll->add($grupos);
     $frame_grupos->add($scroll);
     $frame_funcionalidades->add($multifield_funcionalidades);
     // define the sizes
     $id->setSize(100);
     $nome->setSize(350);
     $prontuario->setSize(150);
     $password->setSize(150);
     $repassword->setSize(150);
     $email->setSize(250);
     $multifield_funcionalidades->setHeight(140);
     // outros
     $id->setEditable(false);
     $funcionalidade_nome->setEditable(false);
     $email->setProperty('autocomplete', 'off');
     // validations
     $nome->addValidation('Nome', new TRequiredValidator());
     $prontuario->addValidation('Prontuário', new TRequiredValidator());
     $email->addValidation('Email', new TEmailValidator());
     $nome->addValidation('Nome', new TMaxLengthValidator(), array(60));
     $prontuario->addValidation('Prontuário', new TMaxLengthValidator(), array(60));
     $email->addValidation('Email', new TMaxLengthValidator(), array(60));
     $funcionalidade_id->setSize(50);
     $funcionalidade_nome->setSize(200);
     // configuracoes multifield
     $multifield_funcionalidades->setClass('Funcionalidade');
     $multifield_funcionalidades->addField('id', 'ID', $funcionalidade_id, 60, true);
     $multifield_funcionalidades->addField('nome', 'Nome', $funcionalidade_nome, 250);
     $multifield_funcionalidades->setOrientation('horizontal');
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome: '), $nome);
     $table->addRowSet(new TLabel('Prontuário: '), $prontuario, new TLabel('Email: '), $email);
     $table->addRowSet(new TLabel('Senha: '), $password, new TLabel('Confirmação <br>da senha: '), $repassword);
     $row = $table->addRow();
     $cell = $row->addCell($frame_grupos);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_funcionalidades);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo');
     $new_button->setImage('ico_new.png');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('UsuarioList', 'onReload')), 'Voltar para a listagem');
     $list_button->setImage('ico_datagrid.png');
     // define the form fields
     $this->form->setFields(array($id, $nome, $prontuario, $password, $repassword, $multifield_funcionalidades, $grupos, $email, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     //$container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'UsuarioList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
Ejemplo n.º 3
0
 /**
  * Shows the exception stack
  */
 function show()
 {
     $error_array = $this->e->getTrace();
     $table = new TTable();
     $row = $table->addRow();
     $message = $this->e->getMessage();
     $message = str_replace('<br>', "\n", $message);
     $title = new GtkLabel();
     $title->set_markup('<b>General Error: ' . $message . '</b>' . "\n");
     $row->addCell($title);
     foreach ($error_array as $error) {
         $file = isset($error['file']) ? $error['file'] : '';
         $line = isset($error['line']) ? $error['line'] : '';
         $file = str_replace(PATH, '', $file);
         $row = $table->addRow();
         $row->addCell('File: ' . $file . ' : ' . $line);
         $row = $table->addRow();
         $args = array();
         if ($error['args']) {
             foreach ($error['args'] as $arg) {
                 if (is_object($arg)) {
                     $args[] = get_class($arg) . ' object';
                 } else {
                     if (is_array($arg)) {
                         $array_param = array();
                         foreach ($arg as $value) {
                             if (is_object($value)) {
                                 $array_param[] = get_class($value);
                             } else {
                                 if (is_array($value)) {
                                     $array_param[] = 'array';
                                 } else {
                                     $array_param[] = $value;
                                 }
                             }
                         }
                         $args[] = implode(',', $array_param);
                     } else {
                         $args[] = (string) $arg;
                     }
                 }
             }
         }
         $label = new GtkLabel();
         $row->addCell($label);
         $class = isset($error['class']) ? $error['class'] : '';
         $type = isset($error['type']) ? $error['type'] : '';
         $label->set_markup('  <i>' . '<span foreground="#78BD4C">' . $class . '</span>' . '<span foreground="#600097">' . $type . '</span>' . '<span foreground="#5258A3">' . $error['function'] . '</span>' . '(' . '<span foreground="#894444">' . implode(',', $args) . '</span>' . ')</i>');
     }
     $scroll = new TScroll();
     $scroll->setSize(690, 390);
     $scroll->add($table);
     $scroll->child->modify_bg(GTK::STATE_NORMAL, GdkColor::parse('#ffffff'));
     parent::add($scroll);
     parent::show();
 }