<?php
/**
* object_search.php :: Modelo de página que apresenta um formulário com critérios
* de pesquisa, os dados fornecidos nesta página serão
* processados na página de lista.
*
* PHP version 4
*
* phpWAFr version 1.1.2
* copyright (c) 2007 Associação SoftwareLivre.org
*
* phpWAFr is an open source PHP library designed to accelerate
* the development of transactional database Web applications.
*
* phpWAFr is released under the terms of the LGPL license 2.1
* http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPL License 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* @package phpWAFr
* @version 1.1.2
* @author Marcelo Rezende <hide@address.com>
* @copyright copyright (c) 2007 Associação SoftwareLivre.org
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPL License 2.1
*/
require_once("../inc/common.php");
/*
verificação do nível do usuário
*/
verifyUser(1);
?>
<html>
<head>
<title>object-search</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="<?=CSS_CONTENT?>">
<script language="JavaScript">
/*
função que chama a página de lista ou relatório,
enviando os parâmetros de pesquisa,
altere somente o nome da página
*/
function search() {
parent.content.document.frm.target = "content";
parent.content.document.frm.action = "../content/object_list.php";
parent.content.document.frm.submit();
}
/*
função que define o foco inicial do formulário
*/
function initiate() {
if (document.captureEvents && Event.KEYUP) {
document.captureEvents( Event.KEYUP);
}
document.onkeyup = trataEvent;
// inicia o foco no primeiro campo
parent.content.document.frm.search_nome_usuario.focus();
}
/*
tratamento para capturar tecla enter
*/
function trataEvent(e) {
if( !e ) { //verifica se é IE
if( window.event ) {
e = window.event;
} else {
//falha, não tem como capturar o evento
return;
}
}
if( typeof( e.keyCode ) == 'number' ) { //IE, NS 6+, Mozilla 0.9+
e = e.keyCode;
} else {
//falha, não tem como obter o código da tecla
return;
}
if (e==13) {
search();
}
}
</script>
</head>
<body class="contentBODY" onload="initiate()">
<?php
pageTitle("Objeto","Pesquisa");
/*
botões de ações,
configure conforme sua necessidade
*/
$button = new Button;
$button->addItem(" OK ", "javascript:search()");
$button->addItem("Fechar", "../content/object_list.php");
echo $button->writeHTML();
?>
<br>
<?php
/*
formulário de pesquisa
*/
$form = new Form("frm");
$form->setMethod( "POST");
$form->setTarget( "content");
$form->setWidth( "100%");
$form->setLabelWidth( "20%");
$form->setDataWidth( "80%");
$form->addHidden("executed", "s");
$form->addField("Nome do usuário: ", textField("search_nome_usuario", "", 20, 20));
$form->addField("Nome real: ", textField("search_nome_real", "", 50, 50));
$sql = "SELECT departamento_id as id, nome_departamento as val FROM departamento ORDER BY nome_departamento";
$form->addField("Departamento: ", listboxField($sql, "search_departamento_id", 0, "Todos"));
echo $form->writeHTML();
?>
</body>
</html>