Message not found na tela de login Olá pessoal, estou com problema na hora de exibir a minha tela de login, fui fazendo conforme o exemplo da Library, mas nas linhas de Usuário e Senha e no botão de Login, aparece a seguinte frase: "Message not found:" OBS: A base de dados não é a mesma que do Library. Abaixo segue os codigos das paginas: INDEX.PHP ...
IM
Message not found na tela de login  
Fechado
Olá pessoal, estou com problema na hora de exibir a minha tela de login, fui fazendo conforme o exemplo da Library, mas nas linhas de Usuário e Senha e no botão de Login, aparece a seguinte frase: "Message not found:"

OBS: A base de dados não é a mesma que do Library.

Abaixo segue os codigos das paginas:

INDEX.PHP

 
  1. <?php
  2. require_once 'init.php';
  3. $theme = 'theme1';
  4. new TSession;
  5. ob_start();
  6. $menu = TMenuBar::newFromXML('menu.xml');
  7. $menu->show();
  8. $menu_string = ob_get_clean();
  9. if (TSession::getValue('logged'))
  10. {
  11. TTransaction::open('library');
  12. $member = User::newFromLogin(TSession::getValue('login'));
  13. if ($member-> tipo_usuario -> des_sigla == 'u')
  14. {
  15. $content = file_get_contents("app/templates/{$theme}/librarian.html");
  16. }
  17. else if ($member-> tipo_usuario -> des_sigla == 'a')
  18. {
  19. $content = file_get_contents("app/templates/{$theme}/layout.html");
  20. }
  21. TTransaction::close();
  22. }
  23. else
  24. {
  25. $content = file_get_contents("app/templates/{$theme}/login.html");
  26. }
  27. //$content = file_get_contents("app/templates/{$theme}/layout.html");
  28. $content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$theme}/libraries.html"), $content);
  29. $content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content);
  30. $content = str_replace('{template}', $theme, $content);
  31. //$content = str_replace('{MENU}', $menu_string, $content);
  32. $content = str_replace('{titlenav}','Gerenciador de Senhas SEMSA - Desenvolvido por Igor Menin (47) 8822-6962',$content);
  33. $css = TPage::getLoadedCSS();
  34. $js = TPage::getLoadedJS();
  35. $content = str_replace('{HEAD}', $css.$js, $content);
  36. $content = str_replace('{login}',TSession::getValue('login'),$content);
  37. $content = str_replace('{estacao}', gethostname(),$content);
  38. echo $content;
  39. if (TSession::getValue('logged'))
  40. {
  41. if (isset($_REQUEST['class']))
  42. {
  43. $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : NULL;
  44. AdiantiCoreApplication::loadPage($_REQUEST['class'], $method, $_REQUEST);
  45. }
  46. }
  47. else
  48. {
  49. //TApplication::gotoPage('LoginForm','');
  50. AdiantiCoreApplication::loadPage('LoginForm', '', $_REQUEST);
  51. }</code>



LoginForm.class.php

 
  1. <?php
  2. class LoginForm extends TPage
  3. {
  4. protected $form; // formulário
  5. /**
  6. * método construtor
  7. * Cria a página e o formulário de cadastro
  8. */
  9. function __construct()
  10. {
  11. parent::__construct();
  12. $table = new TTable;
  13. $table->width = '100%';
  14. // creates the form
  15. $this->form = new TForm('form_login');
  16. $this->form->class = 'tform';
  17. $this->form->style = 'margin:auto;width: 350px';
  18. // add the table inside the form
  19. $this->form->add($table);
  20. // create the form fields
  21. $user = new TEntry('usuario');
  22. $pass = new TPassword('senha');
  23. // add a row for the form title
  24. $row=$table->addRow();
  25. $cell = $row->addCell(new TLabel('Login'));
  26. $cell->colspan = 2;
  27. $row->class = 'tformtitle';
  28. $table->addRowSet(new TLabel(_t('Usuário') . ': '), $user);
  29. $table->addRowSet(new TLabel(_t('Senha') . ': '),$pass);
  30. // create the login button
  31. $save_button=new TButton('login');
  32. $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Acessar'));
  33. $save_button->setImage('fa:check-circle-o green');
  34. $row = $table->addRowSet($save_button,'');
  35. $row->class = 'tformaction';
  36. // define the form fields
  37. $this->form->setFields(array($user, $pass, $save_button));
  38. // add the form to the page
  39. parent::add($this->form);
  40. }
  41. /**
  42. * Validate the login
  43. */
  44. function onLogin()
  45. {
  46. try
  47. {
  48. TTransaction::open('config_bd');
  49. $data = $this->form->getData();
  50. // validate form data
  51. $this->form->validate();
  52. $auth = usuario::autenticate($data->usuario, $data->senha );
  53. if ($auth)
  54. {
  55. TSession::setValue('logged', TRUE);
  56. TSession::setValue('login', $data->usuario );
  57. // reload page
  58. //TApplication::gotoPage('SetupPage', 'onSetup');
  59. }
  60. TTransaction::close();
  61. // finaliza a transação
  62. }
  63. catch (Exception $e) // em caso de exceção
  64. {
  65. TSession::setValue('logged', FALSE);
  66. // exibe a mensagem gerada pela exceção
  67. new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
  68. // desfaz todas alterações no banco de dados
  69. TTransaction::rollback();
  70. }
  71. }
  72. /**
  73. * método onLogout
  74. * Executado quando o usuário clicar no botão logout
  75. */
  76. function onLogout()
  77. {
  78. TSession::setValue('logged', FALSE);
  79. //TApplication::gotoPage('LoginForm', '');
  80. }
  81. }
  82. </code>



Login.html
<!DOCTYPE html>
<html>
<head>
<title>{titlenav}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
{LIBRARIES}
{HEAD}
</head>
<body>
<div class="adianti_container">
<div class="header">
<div class="thin_bar">
 
</div>
<div class="header_content">
<div class="logo1" style="position:relative; width:48%;padding-top:10px">

</div>

<div class="logo2" style="position:relative; width:48%">

</div>
</div>

<div class="header_bottom" style="clear:both"></div>
</div>

<div class="body">
<div id="adianti_div_content" class="login" style="padding-top:80px"></div>
<div id="adianti_online_content"></div>
<div id="pageboth">
</div>
</div>
<div style="clear:both;"></div>
</div>
</body>
</html>

Curso Dominando o Adianti Framework

O material mais completo de treinamento do Framework.
Curso em vídeo aulas + Livro completo + Códigos fontes do projeto ERPHouse.
Conteúdo Atualizado!


Dominando o Adianti Framework Quero me inscrever agora!

Comentários (2)


FP

O problema e na tradução
$table->addRowSet(new TLabel(_t('Usuário') . ': '), $user);
$table->addRowSet(new TLabel(_t('Senha') . ': '),$pass);
remova o _t( ele esta procurando traduzir as palavras e não esta encontrando
use dessa forma

$table->addRowSet(new TLabel('Usuário: '), $user);
$table->addRowSet(new TLabel('Senha': '),$pass);
IM

Obrigado.... :-) Era isso mesmo.. valew.