/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // creates the scroll panel $scroll = new TScroll(); $scroll->setSize(400, 300); // creates a table for the fields $fields_table = new TTable(); // adds the table inside the scroll $scroll->add($fields_table); // create the form fields $fields = array(); for ($n = 1; $n <= 20; $n++) { $object = new TEntry('field' . $n); $fields[$n] = $object; // adds a row for each form field $row = $fields_table->addRow(); $row->addCell(new TLabel('Field:' . $n)); $row->addCell($object); } // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($scroll); parent::add($vbox); }
/** * Class Constructor * @param $type Type of the message (info, error) * @param $message Message to be shown * @param $action Action to process */ public function __construct($type, $message, TAction $action = NULL) { $this->id = uniqid(); if (!is_null($action)) { $this->action = '__adianti_load_page(\'' . $action->serialize() . '\');'; } if (TPage::isMobile()) { $img = new TElement('img'); $img->src = "lib/adianti/images/{$type}.png"; $table = new TTable(); $table->width = '250px'; $table->bgcolor = '#E5E5E5'; $table->style = "border-collapse:collapse"; $row = $table->addRow(); $row->addCell($img); $row->addCell($message); $table->show(); } else { TPage::include_css('lib/adianti/include/tmessage/tmessage.css'); // creates a pannel to show the dialog $painel = new TElement('div'); $painel->{'class'} = 'tmessage'; $painel->id = 'tmessage_' . $this->id; // creates a table for layout $table = new TTable(); // creates a row for the icon and the message $row = $table->addRow(); $row->addCell(new TImage("lib/adianti/images/{$type}.png")); $scroll = new TScroll(); $scroll->setSize(350, 70); $scroll->add($message); $scroll->setTransparency(true); $cell = $row->addCell($scroll); // add the table to the pannel $painel->add($table); // show the pannel $painel->show(); $script = new TElement('script'); $script->{'type'} = 'text/javascript'; $script->add(' $(function() { $( "#' . $painel->id . '" ).dialog({ height: 180, width: 440, stack: false, zIndex: 3000, modal: true, buttons: { OK: function() { $( this ).dialog( "close" ); ' . $this->action . ' } } }).css("visibility", "visible"); $( "#' . $painel->id . ' a" ).click(function () { window.open($(this).attr(\'href\')); }); });'); $script->show(); } }
/** * 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); var_dump($this->e->getTraceAsString()); 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(); }
/** * Constructor method */ function __construct($e) { $error_array = $e->getTrace(); $table = new TTable(); $row = $table->addRow(); $row->addCell('<b>Error: ' . $e->getMessage() . '<br>'); $row = $table->addRow(); $row->addCell(' '); 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(' <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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // define the tree data $data = array(); $data['Brazil']['RS'][10] = 'Lajeado'; $data['Brazil']['RS'][20] = 'Cruzeiro do Sul'; $data['Brazil']['RS'][30] = 'Porto Alegre'; $data['Brazil']['SP'][40] = 'São Paulo'; $data['Brazil']['SP'][50] = 'Osasco'; $data['Brazil']['MG'][60] = 'Belo Horizonte'; $data['Brazil']['MG'][70] = 'Ipatinga'; // scroll around the treeview $scroll = new TScroll(); $scroll->setSize(300, 200); // creates the treeview $treeview = new TTreeView(); $treeview->setSize(300); $treeview->setItemIcon('ico_file.png'); $treeview->setItemAction(new TAction(array($this, 'onSelect'))); $treeview->fromArray($data); // fill the treeview $scroll->add($treeview); // creates a simple form $this->form = new TQuickForm('form_test'); // creates the notebook around the form $notebook = new TNotebook(350, 100); $notebook->appendPage('Quick form component', $this->form); // creates the form fields $key = new TEntry('key'); $value = new TEntry('value'); $this->form->addQuickField('Key', $key, 50); $this->form->addQuickField('Value', $value, 170); // creates a table to wrap the treeview and the form $table = new TTable(); $row = $table->addRow(); $cell = $row->addCell($scroll)->valign = 'top'; $cell = $row->addCell($notebook)->valign = 'top'; // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($table); parent::add($vbox); }
public function __construct() { // parent classs constructor parent::__construct(); // scroll to put the source inside $scroll = new TScroll(); $scroll->setSize(640, 460); if (PHP_SAPI !== 'cli') { $scroll->style = 'padding: 4px; border-radius: 4px;'; } $source = new TSourceCode(); $source->loadFile('app/resources/Persistence/Relationships/Composition.php'); $scroll->add($source); // wrap the page content $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($scroll); parent::add($vbox); }
public function __construct() { // parent classs constructor parent::__construct(); parent::setSize(0.8, 0.8); // label to present the docs $this->label = new TText('name'); $this->label->setSize(690, 130); // notebook to put the scroll inside $note = new TNotebook(700, 150); $note->appendPage('Explanation', $this->label); // scroll to put the source inside $scroll2 = new TScroll(); $scroll2->setSize(700, 250); $this->source = new TSourceCode(); $scroll2->add($this->source); // create a table to organize the layout $page = new TTable(); $row1 = $page->addRow(); $row2 = $page->addRow(); $row1->addCell($note); $row2->addCell($scroll2); parent::add($this->source); }
/** * Class Constructor * @param $message A string containint the question * @param $action_yes Action taken for YES response * @param $action_no Action taken for NO response */ public function __construct($message, TAction $action_yes = NULL, TAction $action_no = NULL) { $this->id = uniqid(); if (TPage::isMobile()) { $img = new TElement('img'); $img->src = "lib/adianti/images/question.png"; $yes = new TElement('a'); $yes->href = $action_yes->serialize(); $yes->generator = 'adianti'; $yes->add(TAdiantiCoreTranslator::translate('Yes')); $no = new TElement('a'); $no->href = $action_no->serialize(); $no->generator = 'adianti'; $no->add(TAdiantiCoreTranslator::translate('No')); $table = new TTable(); $table->width = '250px'; $table->bgcolor = '#E5E5E5'; $table->style = "border-collapse:collapse"; $row = $table->addRow(); $row->addCell($img); $table2 = new TTable(); $row->addCell($table2); $row = $table2->addRow(); $c = $row->addCell($message); $c->colspan = 2; $row = $table2->addRow(); $row->addCell($yes); $row->addCell($no); $table->show(); } else { TPage::include_css('lib/adianti/include/tmessage/tmessage.css'); // creates a layer to show the dialog $painel = new TElement('div'); $painel->{'class'} = "tmessage"; $painel->id = 'tquestion_' . $this->id; $url_yes = ''; $url_no = ''; if ($action_yes) { // convert the actions into URL's $url_yes = TAdiantiCoreTranslator::translate('Yes') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_yes->serialize() . '\');},'; } if ($action_no) { $url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" ); __adianti_load_page(\'' . $action_no->serialize() . '\');},'; } else { $url_no = TAdiantiCoreTranslator::translate('No') . ': function () { $( this ).dialog( "close" );},'; } // creates a table for layout $table = new TTable(); // creates a row for the icon and the message $row = $table->addRow(); $row->addCell(new TImage("lib/adianti/images/question.png")); $scroll = new TScroll(); $scroll->setSize(400, 200); $scroll->add($message); $cell = $row->addCell($scroll); // add the table to the pannel $painel->add($table); // show the pannel $painel->show(); $script = new TElement('script'); $script->add(' $(function() { $( "#' . $painel->id . '" ).dialog({ height: 340, width: 500, modal: true, stack: false, zIndex: 3000, buttons: { ' . $url_yes . $url_no . TAdiantiCoreTranslator::translate('Cancel') . ': function() { $( this ).dialog( "close" ); } } }).css("visibility", "visible"); });'); $script->show(); } }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table1 = new TTable(); $table2 = new TTable(); $hbox1 = new THBox(); $hbox2 = new THBox(); $table->style = 'width: 100%'; $table1->style = 'width: 100%'; $table2->style = 'width: 100%'; $this->form->add($table); $table->addRowSet(new TLabel(_t('User')), '', '', '')->class = 'tformtitle'; $table->addRowSet($hbox1); $table->addRowSet($hbox2); $hbox1->add($table1); $hbox1->add($table2); // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend(_t('Groups')); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend(_t('Programs')); $frame_programs->style .= ';margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 240); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize('50%'); $name->setSize('100%'); $login->setSize('100%'); $password->setSize('100%'); $repassword->setSize('100%'); $email->setSize('100%'); $frontpage_id->setSize('20%'); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $row = $table1->addRow(); $row->addCell(new TLabel('ID:'))->style = 'width:150px'; $row->addCell($id); $table1->addRowSet(new TLabel(_t('Login') . ': '), $login); $table1->addRowSet(new TLabel(_t('Password') . ': '), $password); $table1->addRowSet(new TLabel(_t('Password confirmation') . ': '), $repassword); $row = $table2->addRow(); $row->addCell(new TLabel('Name:'))->style = 'width:150px'; $row->addCell($name); $table2->addRowSet(new TLabel(_t('Email') . ': '), $email); $table2->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id); $table2->addRowSet(new TLabel(_t('Page name') . ': '), $frontpage_name); $hbox2->add($frame_groups); $hbox2->add($frame_programs); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend('Grupos'); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend('Programas'); $frame_programs->style .= ';margin: 15px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation('Nome', new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', 'Nome', $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name); $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email); $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword); $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name); $row = $table->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $row = $table->addRow(); $cell = $row->addCell($frame_programs); $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('SystemUserList', 'onReload')), 'Voltar para listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $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', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the notebook $this->notebook = new TNotebook(); $this->notebook->setSize(700, 390); // creates the table container $tableCampos = new TTable(); // creates the form $this->form = new TForm('form_System_user'); $this->notebook->appendPage(_t('User'), $tableCampos); // add the notebook inside the form $this->form->add($this->notebook); $frame_groups = new TFrame(300, 250); $frame_groups->setLegend(_t('Groups')); $frame_groups->style = 'margin: 4px'; $frame_programs = new TFrame(340, 250); $frame_programs->setLegend(_t('Programs')); $frame_programs->style = 'margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $tableCampos->addRowSet(new TLabel('ID:'), $id, new TLabel(_t('Name') . ': '), $name); $tableCampos->addRowSet(new TLabel(_t('Login') . ': '), $login, new TLabel(_t('Email') . ': '), $email); $tableCampos->addRowSet(new TLabel(_t('Password') . ': '), $password, new TLabel(_t('Password confirmation') . ': '), $repassword); $tableCampos->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id, new TLabel(_t('Page name') . ': '), $frontpage_name); $row = $tableCampos->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $cell = $row->addCell($frame_programs); $cell->colspan = 2; // 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'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button)); $table_buttons = new TTable(); $row_buttons = $table_buttons->addRow(); $row_buttons->addCell($save_button); $row_buttons->addCell($new_button); $row_buttons->addCell($list_button); $container = new TTable(); $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList')); $container->addRow()->addCell($this->form); $container->addRow()->addCell($table_buttons); // add the form to the page parent::add($container); }