/**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TQuickForm('form_Categoria');
     $this->form->class = 'tform';
     // CSS class
     // define the form title
     $this->form->setFormTitle('Categoria');
     // defines the database
     parent::setDatabase('sample');
     // defines the active record
     parent::setActiveRecord('Categoria');
     // create the form fields
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $descricao = new THtmlEditor('descricao');
     // add the fields
     $this->form->addQuickField('', $id, 100);
     $this->form->addQuickField('nome', $nome, 200);
     $this->form->addQuickField('descricao', $descricao, 200);
     $descricao->setSize(400, 300);
     // add a form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add a form action
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 public function __construct()
 {
     parent::__construct();
     //checa para verificar se esta logado
     Usuario::checkLogin();
     //verifica o nivel de usuario que pode acessar
     Usuario::acesso(3);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Usuario');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('login');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Usuario');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('login');
     $filter->setValue(TSession::getValue('Usuario_login'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('login:'******'find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New'));
     $find_button->setImage('ico_find.png');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200);
     $senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Pedidos');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('id');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Pedidos');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('id');
     $filter->setValue(TSession::getValue('Pedidos_id'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('id:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     // add a row for the form actions
     $table->addRowSet($find_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $dataP = $this->datagrid->addQuickColumn('dataP', 'dataP', 'left', 100);
     $clientes_id = $this->datagrid->addQuickColumn('cliente', 'clientes->nome', 'right', 100);
     $status = $this->datagrid->addQuickColumn('status', 'status', 'right', 100);
     // create the datagrid actions
     $itens_action = new TDataGridAction(array($this, 'showItens'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction("Produtos", $itens_action, 'id', 'ico_find.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TQuickForm('form_Clientes');
     $this->form->class = 'tform';
     // CSS class
     // define the form title
     $this->form->setFormTitle('Clientes');
     // defines the database
     parent::setDatabase('sample');
     // defines the active record
     parent::setActiveRecord('Clientes');
     // create the form fields
     $id = new THidden('id');
     $nome = new TEntry('nome');
     $sobrenome = new TEntry('sobrenome');
     $cep = new TEntry('cep');
     $logradouro = new TEntry('logradouro');
     $bairro = new TEntry('bairro');
     $cidade = new TEntry('cidade');
     $email = new TEntry('email');
     $dd = new TEntry('dd');
     $telefone = new TEntry('telefone');
     // mascaras nos campos usa-se o 9 para numero e o # para letra
     $telefone->setMask('9999-9999');
     $dd->setMask('99');
     $cep->setMask('99999-999');
     // valida email
     $email->addValidation('E-mail', new TEmailValidator());
     //  new TRequiredValidator validador que faz com que o campo seja obrigatorio
     // add the fields
     $this->form->addQuickField('id', $id, 100);
     $this->form->addQuickField('nome', $nome, 200, new TRequiredValidator());
     $this->form->addQuickField('sobrenome', $sobrenome, 200, new TRequiredValidator());
     $this->form->addQuickField('cep', $cep, 200, new TRequiredValidator());
     $this->form->addQuickField('logradouro', $logradouro, 200, new TRequiredValidator());
     $this->form->addQuickField('bairro', $bairro, 200, new TRequiredValidator());
     $this->form->addQuickField('cidade', $cidade, 200, new TRequiredValidator());
     $this->form->addQuickField('email', $email, 200, new TRequiredValidator());
     $this->form->addQuickField('dd', $dd, 200, new TRequiredValidator());
     $this->form->addQuickField('telefone', $telefone, 200, new TRequiredValidator());
     // add a form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add a form action
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TForm('form_Usuario');
     $this->form->class = 'tform';
     // CSS class
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Usuario'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $login = new TEntry('login');
     $senha = new TPassword('senha');
     // define the sizes
     $id->setSize(100);
     $login->setSize(200);
     $senha->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('login:'******'senha:'), $senha);
     // 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');
     $this->form->setFields(array($id, $login, $senha, $save_button, $new_button));
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // cria o formulario
     $this->form = new TQuickForm('form_Produtos');
     $this->form->class = 'tform';
     // class css do framework
     // titulo do formulario
     $this->form->setFormTitle('Produtos');
     // banco de dados em uso
     parent::setDatabase('sample');
     // model em uso
     parent::setActiveRecord('Produtos');
     // cria os campos do formulario
     $id = new THidden('id');
     $nome = new TEntry('nome');
     //eleciona a categoria
     $categoria = new TDBCombo('categoria_id', 'sample', 'Categoria', 'id', 'nome', 'nome');
     $descricao = new THtmlEditor('descricao');
     $preco = new TEntry('preco');
     $imagem = new PFile('imagem');
     $imagem->setFolder('uploads');
     $preco->addValidation('preco', new TNumericValidator());
     // somente numeros
     $preco->setNumericMask(2, '.', '');
     // seta a mascara para o mesmo padrao do mysql
     // adiciona os campos label,campo,tamanho
     $this->form->addQuickField('', $id, 100);
     $this->form->addQuickField('nome', $nome, 200);
     $this->form->addQuickField('preco', $preco, 200);
     $this->form->addQuickField('categoria', $categoria, 200);
     $this->form->addQuickField('imagem', $imagem, 200);
     $this->form->addQuickField('descricao', $descricao, 200);
     // para alterar o tamanho de componentes em sua altura e largura
     //deve coloca-las apos adicionar o campos no form
     $descricao->setSize(400, 300);
     // adciona actions no form
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // adciona o form na pagina
     parent::add($this->form);
 }
示例#8
0
<?php

$user = new Usuario();
$usuario = $user->checkLogin();
if (!empty($usuario)) {
    ?>
		<hr>
		<span class="saludo"> Hola <?php 
    echo $usuario;
    ?>
</span>
		<div id="logoutform">
			<form action="logout.php" method="post">
				<input type="submit" value="Salir">
			</form>
		</div>
		<?php 
}
?>
	</body>
</html>
示例#9
0
<!DOCTYPE html>
<html>
	<head>
		<?php 
require_once "classes/dispatcher.php";
Dispatcher::init();
require_once "classes/usuario.php";
Usuario::checkLogin();
?>
		<title>URL Shortener</title>
		<meta charset="utf-8" />
		<script src="jQuery/jquery-1.10.1.min.js"></script>
		<script src="jQuery/jquery-1.9.0.min.js"></script>
		
		<!--Inlude fancybox plugin -->
		<script type="text/javascript" src="jQuery/fancyBox/lib/jquery.mousewheel-3.0.6.pack.js"></script>
		<script src="jQuery/fancyBox/source/jquery.fancybox.js"></script>
		<script src="jQuery/fancyBox/source/jquery.fancybox.pack.js"></script>
		<script type="text/javascript" src="jQuery/fancyBox/source/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
		<script type="text/javascript" src="js/global.js"></script>
		<link rel="stylesheet" type="text/css" href="jQuery/fancyBox/source/jquery.fancybox.css" />
		<link rel="stylesheet" type="text/css" href="jQuery/fancyBox/source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
		<link rel="stylesheet" type="text/css" href="css/font-awesome.css" />
		<link rel="stylesheet" type="text/css" href="css/global.css" />
		
	</head>
	<body>
		<h1><a href="index.php">URL Shortener</a></h1>
		<?php 
include_once "menu.php";
?>
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TForm('form_search_Produtos');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('nome');
     $filter->setValue(TSession::getValue('Produtos_nome'));
     // add a row for the filter field
     $row = $table->addRowSet(new TLabel('nome:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $new_button->setAction(new TAction(array('ProdutosForm', 'onEdit')), _t('New'));
     $find_button->setImage('ico_find.png');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $row = $table->addRowSet($find_button, $new_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('id', 'id', 'right', 100);
     $nome = new TDataGridColumn('nome', 'nome', 'left', 200);
     $descricao = new TDataGridColumn('descricao', 'descricao', 'left', 200);
     $preco = new TDataGridColumn('preco', 'preco', 'left', 200);
     $imagem = new TDataGridColumn('imagem', 'imagem', 'left', 200);
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($nome);
     $this->datagrid->addColumn($descricao);
     $this->datagrid->addColumn($preco);
     $this->datagrid->addColumn($imagem);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('ProdutosForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('ico_edit.png');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('ico_delete.png');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
示例#11
0
<?php

require_once "classes/modelo.php";
require_once 'classes/usuario.php';
$usuario = new Usuario();
$usuario->logout();
$usuario->checkLogin();