Escolar Documentos
Profissional Documentos
Cultura Documentos
Uruguaiana - RS
2010
DIEGO RAFAEL FLORES BARBAT
Uruguaiana - RS
2010
Dedico este trabalho a minha família, que
sempre me apoiou e ajudou-me para que eu
conseguisse concluir o curso de Análise e
Desenvolvimento de Sistemas.
1 INTRODUÇÃO
2 JUSTIFICATIVA
3 OBJETIVOS
4 REFERENCIAL TEÓRICO
5 METODOLOGIA
7 TECNOLOGIA
8 LEVANTAMENTO DE REQUISITOS
9 DIAGRAMAS
10 CRONOGRAMA
11 CONCLUSÃO
REFERÊNCIAS
SILVA, Jaime J. Help Desk com sistema RBC para as gerências de aplicativos
do Banco do Brasil. 2004. 45 f. Trabalho de Conclusão de Curso (Curso de
Especialização e Desenvolvimento, segurança e Qualidade a Internet) – Instituto de
Informática, Universidade Federal do Rio Grande do Sul, Porto Alegre. Acesso em
01 de Outubro de 2010.
UNIPRESS, Software Inc. O Help Desk baseado na web: O que ele pode fazer
por sua empresa e porque você precisa dele. NM Brasil, [São Paulo], n.15, fev.,
2001.Disponível em:
http://www.mmbrasil.com.br/images/stories/solucoes/doc/footprints.pdf. Acesso em:
25 setembro de 2010.
ANEXOS
27
BUSCACONCOP.PHP
<?php
// Incluir aquivo de conexão
require_once("libs/conn.php");
?>
CADCHA.PHP
<?php require_once("libs/conn.php");
@session_start();
?>
$("#formulario").submit(function() {
// Colocamos os valores de cada campo em uma v�riavel para facilitar
a manipula��o
var ncopiadora = $("#ncopiadora").val();
var descdefeito = $("#descdefeito").val();
var obsdefeito = $("#obsdefeito").val();
// Exibe mensagem de carregamento
$("#status").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requis�o ajax com o arquivo tratacadcop.php e
enviamos os valores de cada campo atrav�s do m�todo POST
$.post('tratacadcha.php', {ncopiadora: ncopiadora, descdefeito:
descdefeito, obsdefeito: obsdefeito }, function(resposta) {
// Quando terminada a requisi��o
// Exibe a div status
$("#status").slideDown();
// Se a resposta � um erro
if (resposta != false) {
// Exibe o erro na div
$("#status").html(resposta);
}
// Se resposta for false, ou seja, n�o ocorreu nenhum
erro
else {
// Exibe mensagem de sucesso
$("#status").html("Cadastro Efetuado com
Sucesso!");
// Limpando todos os campos
$("#ncopiadora").val("");
$("descdefeito").val("");
}
});
});
});
</script>
// Divs 1
$("#dachamado").hide();
$("#achamado").click(function () {
$("#dachamado").slideToggle("slow");
});
// Div 2
$("#dvchamado").hide();
$("#vchamado").click(function () {
$("#dvchamado").slideToggle("slow");
36
});
$("#ddnota").hide();
$("#dnota").click(function () {
$("#ddnota").slideToggle("slow");
});
});
</script>
</head>
<body>
<div id="geral">
<?php
$nome= $_SESSION["nome"];
$id= $_SESSION["id"];
$categoria = $_SESSION["categoria"];
$email= $_SESSION["email"];
//if($categoria != '0'){
// echo "<strong>De:</strong> $nome<br/>";
//}
?>
<?php
//guarda a data atual
$d= date("d/m/Y");//dia/mes/ano
$t = date('h:i');//hora:minutos
$data = "$d $t";
?>
</fieldset><br />
<div id="dachamado">
<strong>Data:</strong><?php echo" $d ";?>
<strong>Hora: </strong> <?php echo" $t ";?> <br />
<br /><table>
<tr><td class="fundolabel"><label
for="nome"><strong>Nome:</strong></label></td>
<td class="fundolabel"><?php echo"$nome" ?></td></tr>
<tr><td class="fundolabel"><label
for="obsdefeito"><strong>Observações:</strong></label></td>
<td><textarea name="obsdefeito" cols="82" rows="15" id="obsdefeito"
method="post"><?php echo"$data"?></textarea></td></tr>
</table>
<br /><center>
<input type="submit" value="Salvar" >
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</div>
38
<div id="dvchamado">
<br/ >
<fieldset>
<legend>Acompanhe seus Chamados!</legend>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DEFEITO</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">SITUAÇÃO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">IMPRIMIR</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">LER</div></td>
</tr>
<?php
$sql = "select id,nome,descdefeito,situacao from chamados WHERE nome =
'$nome'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
echo $linha["descdefeito"];
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
echo '</tr>';
}
echo '</table>';
?>
</fieldset>
</div>
<div id="ddnota">
<?php include('nota.php');?>
</div>
</div>
</div>
</body>
</html>
CADVISITA.PHP
<?php require_once("libs/conn.php");
@session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastro de Copiadoras</title>
<!-- Incluimos a biblioteca do jquery -->
<script type="text/javascript" language="javascript" src="libs/jquery.js"></script>
<!-- Incluimos a folha de estilo css -->
<link type="text/css" rel="stylesheet" href="libs/stilo.css">
<!-- Criamos as funções necessárias para envio do formulário -->
<script type="text/javascript" language="javascript">
$(function($) {
// Quando o formulário for enviado, essa função é chamada
$("#formulario").submit(function() {
// Colocamos os valores de cada campo em uma váriavel para facilitar
a manipulação
var nomecliente = $("#nomecliente").val();
var datavisita = $("#datavisita").val();
var descvisita = $("#descvisita").val();
// Exibe mensagem de carregamento
$("#status").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requisão ajax com o arquivo tratacadcop.php e enviamos
os valores de cada campo através do método POST
$.post('tratacadvisita.php', {nomecliente: nomecliente, datavisita:
datavisita, descvisita: descvisita }, function(resposta) {
// Quando terminada a requisição
// Exibe a div status
$("#status").slideDown();
// Se a resposta é um erro
if (resposta != false) {
40
<body>
<?php
//guarda a data atual
$d= date("d/m/Y");//dia/mes/ano
$t = date('h:i');//hora:minutos
$data = "$d $t";
?>
<?php
$id= $_SESSION["id"];
$nome= $_SESSION["nome"];
?>
<div id="saudacao"><?php include 'topo.php';?> </div>
<div id="escrever">
<fieldset>
<legend class="legendfield">Cadastro de Visitas</legend>
<!-- Div que mostra as mensagens de confirmação e erro -->
<div id="status"></div>
<form id="formulario" action="javascript:func()" method="post">
<a href="desloga.php"><img src="img/Exit.png" width="32" height="32"
border="0" align="right" /></a>
<br />
<table>
<tr><td class="fundolabel"><label
for="nomevendedor"><strong>Nome:</strong></label></td>
<td class="fundolabel"><?php echo"$nome" ?></td></tr>
<tr><td class="fundolabel"><label
for="nomecliente"><strong>Cliente:</strong></label></td>
<td>
<select name="nomecliente" id="nomecliente">
41
<option>
<!--SELECIONA O NOME DOS CLIENTES E EXIBE DENTRO DO
SELECT -->
<?php
$consulta = mysql_query("SELECT id,nome FROM usuarios
WHERE categoria = 'cliente'");
while( $row = mysql_fetch_array($consulta) )
{
echo "<option
value=\"{$row['nome']}\">{$row['nome']}</option>\n";
}
?>
</option>
</select>
</td></tr>
<tr><td class="fundolabel"><label
for="datavisita"><strong>Data:</strong></label></td>
<td><input name="datavisita" type="text" id="datavisita" size="15"
maxlength="10" /></td></tr>
<tr><td class="fundolabel"><label
for="descvisita"><strong>Descrição:</strong></label></td>
<td><textarea name="descvisita" cols="82" rows="15" id="descvisita"
method="post"><?php echo"$data"?></textarea></td></tr>
</table> <br />
<center>
<input type="submit" value="Salvar" />
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</fieldset>
</div>
</body>
</html>
CHASECRETARIA.PHP
<?php require_once("libs/conn.php");
@session_start();
?>
}
</script>
<script>
$(document).ready(function(){
// Divs 1
$("#dachamado").hide();
$("#achamado").click(function () {
$("#dachamado").slideToggle("slow");
});
// Div 2
$("#dvchamado").hide();
$("#vchamado").click(function () {
$("#dvchamado").slideToggle("slow");
});
$("#ddvisita").hide();
$("#dvisita").click(function () {
$("#ddvisita").slideToggle("slow");
});
});
</script>
</head>
<body>
<div id="geral">
<?php
$nome= $_SESSION["nome"];
$id= $_SESSION["id"];
$categoria = $_SESSION["categoria"];
$email= $_SESSION["email"];
//if($categoria != '0'){
// echo "<strong>De:</strong> $nome<br/>";
//}
?>
<?php
//guarda a data atual
$d= date("d/m/Y");//dia/mes/ano
$t = date('h:i');//hora:minutos
$data = "$d $t";
?>
</fieldset><br />
<div id="dachamado">
<strong>Data:</strong><?php echo" $d ";?>
<strong>Hora: </strong> <?php echo" $t ";?> <br />
<br /><table>
<tr><td class="fundolabel"><label
for="nome"><strong>Nome:</strong></label></td>
<td class="fundolabel"><?php echo"$nome" ?></td></tr>
<tr><td class="fundolabel"><label
for="obsdefeito"><strong>Observações:</strong></label></td>
45
</table>
<br /><center>
<input type="submit" value="Salvar" >
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</div>
<div id="dvchamado">
<br/ >
<fieldset>
<legend>Acompanhe seus Chamados!</legend>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DEFEITO</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">SITUAÇÃO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">IMPRIMIR</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">LER</div></td>
</tr>
<?php
$sql = "select id,nome,descdefeito,situacao from chamados";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
echo $linha["descdefeito"];
46
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
}
echo '</table>';
?>
</fieldset>
</div>
<div id="ddvisita">
<br/ >
<fieldset>
<legend>Acompanhe as Visitas!</legend>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">CLIENTE</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DATA</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DESCRICAO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">IMPRIMIR</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">LER</div></td>
</tr>
<?php
$sql = "select idvisita,nomevendedor,nomecliente,datavisita,descvisita from visitas";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
47
}
echo '</table>';
?>
</fieldset>
</div>
</div>
</div>
</body>
</html>
CHATECNICO.PHP
<?php require_once("libs/conn.php");
@session_start();
?>
{
print(document);
}
</script>
// Divs 1
$("#dachamado").hide();
$("#achamado").click(function () {
$("#dachamado").slideToggle("slow");
});
// Div 2
$("#dvchamado").hide();
$("#vchamado").click(function () {
$("#dvchamado").slideToggle("slow");
});
$("#ddnota").hide();
$("#dnota").click(function () {
$("#ddnota").slideToggle("slow");
});
});
</script>
</head>
<body>
<div id="geral">
<?php
$nome= $_SESSION["nome"];
$id= $_SESSION["id"];
$categoria = $_SESSION["categoria"];
$email= $_SESSION["email"];
//if($categoria != '0'){
// echo "<strong>De:</strong> $nome<br/>";
//}
?>
<?php
//guarda a data atual
$d= date("d/m/Y");//dia/mes/ano
$t = date('h:i');//hora:minutos
$data = "$d $t";
?>
<fieldset>
<legend class="legendfield">Seus Chamados</legend>
<!-- Div que mostra as mensagens de confirmação e erro -->
<div id="status"></div>
<div>
<form id="formulario" action="javascript:func()" method="post">
<br />
<fieldset><legend>O que Você Deseja:</legend>
<input type="button" name="tcliente" id="vchamado" value="Visualizar
Chamados">
<a href="desloga.php">
<input type="button" name="sair" id="sair" value="Encerrar Sessão">
</a>
</fieldset><br />
<div id="dvchamado">
<br/ >
<fieldset>
<legend>Acompanhe seus Chamados!</legend>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DEFEITO</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">SITUAÇÃO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">IMPRIMIR</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">LER</div></td>
</tr>
<?php
$sql = "select id,nome,descdefeito,situacao,atecnico from chamados WHERE
atecnico = '$nome'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
51
echo $linha["descdefeito"];
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
}
echo '</table>';
?>
</fieldset>
</div>
<div id="ddnota">
<?php include('nota.php');?>
</div>
</div>
</div>
</body>
</html>
CONCOP.PHP
<body>
<fieldset>
<legend class="legendfield">Consulta de Copiadoras</legend>
<strong>Digite o Modelo:</strong><br />
<input type="text" id="busca" onkeyup="buscarcopiadoras(this.value)" />
<div id="resultado"></div>
52
<?php
$host = "localhost"; // LOCAL ONDE FICA O BD
$usuario = "root"; //USUARIO PADRAO
$senha = ""; //senha
$con = @mysql_connect($host,$usuario,$senha); // funcao que verifica dados e
conecta ao bd
if(!$con)
{
?>
DELCOP.PHP
<?php
require_once("libs/conn.php");
if(isset($_GET['id'])){ //recebe o valor do id
$sql = "delete from copiadoras where id=" .$_GET['id']; // deleta o id recebido
$query = mysql_query($sql);
if($query){
echo "Copiadora excluida do sistema com sucesso";
header("location:exibeconcop.php");
}else{
echo "Não foi possivel deletar";
}
}
?>
DESLOGA.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("libs/conn.php");
@session_start();
?>
<div>
<form id="formulario" action="javascript:func()" method="post">
<fieldset>
<legend>Classifique seu Atendimento!</legend>
<div id="statusn"></div>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
54
<?php
$sql = "select id,nome,descdefeito,situacao from chamados WHERE
nome = '$nome'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
echo $linha["descdefeito"];
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
echo '</tr>';
}
echo '</table>';
?>
</fieldset>
<br /><center>
<input type="submit" value="Salvar" >
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</div>
</body>
</html>
55
EXIBECONCOP.PHP
<body>
<?php
// Incluir aquivo de conexão
require_once("libs/conn.php");
?>
<fieldset>
<legend>Consulta de Copiadoras!</legend>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">CÓDIGO</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">Nº DE SERIE</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">MODELO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NUMERADOR</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">EXCLUIR</div></td>
</tr>
<?php
$sql = "select id,nserie,modelo,numerador from copiadoras WHERE id
56
= '".$id."'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nserie"];
echo '</td>';
echo '<td align="center">';
echo $linha["modelo"];
echo '</td>';
echo '<td align="center">';
echo $linha["numerador"];
echo '</td>';
}
echo '</table>';
mysql_free_result($resultado);
?>
</fieldset>
</body>
</html
INDEX.PHP
<body>
<form action="loga.php" method="post" enctype="application/x-www-form-
urlencoded" name="form1" id="form1">
<tr>
<td width="320" height="133">
<p> </p>
57
LOGA.PHP
<?php
session_start();
if(!empty($_POST['email']) || !empty($_POST['senha'])){
$email = 'admin@admin.com.br';
$Senha = 'admin';
$_SESSION["nome"] = 'Administrador';
header("Location:admin/index.php");
}
if(!empty($_POST['email']) || !empty($_POST['senha'])){
$email = trim($_POST['email']);
$Senha = trim($_POST['senha']);
//Busca Usuario
$sqlLogin = "SELECT id,nome,senha,email,categoria FROM usuarios
WHERE senha = '$Senha' AND email = '$email'";
$FindUser = mysql_query($sqlLogin) or die('erro o conectar');
$dados = mysql_fetch_row($FindUser);
if($dados['0'] != 0){
//Criando SESSION
$_SESSION["id"] = $dados[0];
$_SESSION["nome"] = $dados[1];
$_SESSION["email"] = $email;
$_SESSION["senha"] = $Senha;
$_SESSION["categoria"] = $dados[4];
if($dados['4'] == "cliente"){
header("Location: cadcha.php");
exit();
}
59
if($dados['4'] == "vendedor"){
header("Location: cadvisita.php");
exit();
}
if($dados['4'] == "tecnico"){
header("Location: chatecnico.php");
exit();
}
if($dados['4'] == "secretaria"){
header("Location: chasecretaria.php");
exit();
}
}
else{
<?php require_once("libs/conn.php");
@session_start();
?>
a manipula��o
var nota = $("#nota").val();
var id = $("#id").val();
// Exibe mensagem de carregamento
$("#statusn").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requis�o ajax com o arquivo tratacadcop.php e
enviamos os valores de cada campo atrav�s do m�todo POST
$.post('tratanota.php', {nota: nota}, function(resposta) {
// Quando terminada a requisi��o
// Exibe a div status
$("#statusn").slideDown();
// Se a resposta � um erro
if (resposta != false) {
// Exibe o erro na div
$("#statusn").html(resposta);
}
// Se resposta for false, ou seja, n�o ocorreu nenhum
erro
else {
// Exibe mensagem de sucesso
$("#statusn").html("Cadastro Efetuado com
Sucesso!");
// Limpando todos os campos
$("#nota").val("");
}
});
});
});
</script>
</head>
<body>
<br/ >
<div>
<form id="formulario" action="javascript:func()" method="post">
<fieldset>
<legend>Classifique seu Atendimento!</legend>
<div id="statusn"></div>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DEFEITO</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">SITUAÇÃO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
61
class="style13 style1">NOTA</div></td>
<?php
$sql = "select id,nome,descdefeito,situacao from chamados WHERE
nome = '$nome'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
echo $linha["descdefeito"];
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
echo '</tr>';
}
echo '</table>';
?>
</fieldset>
<br /><center>
<input type="submit" value="Salvar" >
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</div>
</body>
</html>
TOPO.PHP
<?php
$nome = $_SESSION['nome'];
echo '<div align="center">';
$hora = date("H");
if($hora >= 0 && $hora < 6){
echo 'Boa Madrugada </font>';
}elseif ($hora >= 6 && $hora < 12){
echo 'Bom Dia </font>';
62
?>
TRATACADCHA.PHP
<?php
@session_start();
// Incluimos o arquivo de conexão
require_once("conn.php");
// Recuperamos os valores dos campos através do método POST utizando o TRIM
para retirar os espaços entre os caracteres
$nome = $_SESSION["nome"];
$ncopiadora = trim($_POST["ncopiadora"]);
$descdefeito = trim($_POST["descdefeito"]);
$obsdefeito = trim($_POST["obsdefeito"]);
$situacao = "Em Espera";
$nota = "Sem Nota";
if (empty($ncopiadora)) {
echo "Escolha o Modelo do seu Equipamento";
}
elseif (empty($descdefeito)) {
echo "Digite o seu Defeito";
}
require_once("libs/conn.php");
@session_start();
// Recuperamos os valores dos campos através do método POST utizando o TRIM
para retirar os espaços entre os caracteres
$nomevendedor= $_SESSION["nome"];
$nomecliente = trim($_POST["nomecliente"]);
$datavisita = trim($_POST["datavisita"]);
$descvisita = trim($_POST["descvisita"]);
elseif (empty($datavisita)) {
echo "Digite a Data da Visita";
}
elseif (empty($descvisita)) {
echo "Digite a Descrição da Visita";
}
$nota = trim($_POST["nota"]);
$id = $_SESSION["id"];
if (empty($nota)) {
echo "Escolha uma Nota para o seu Atendimento";
}
VCHAMADO.PHP
<?php
require_once("libs/fpdf.php");
@session_start();
$id = $_SESSION["id"];
$nome = $_SESSION["nome"];
$descdefeito = $_SESSION["descdefeito"];
$situacao = $_SESSION["situcao"];
$pdf->AddPage();
$pdf->Image('img/logocomaco.gif');
$pdf->SetFont('arial','B',18);
$pdf->Cell(0,5,"Relatorio de Chamado",0,1,'C');
$pdf->Cell(0,5,"","B",1,'C');
$pdf->Ln(8);
//id
$pdf->SetFont('arial','B',12);
$pdf->Cell(70,20,"Codigo:",0,0,'L');
$pdf->setFont('arial','',12);
$pdf->Cell(0,20,$id,0,1,'L');
65
//nome
$pdf->SetFont('arial','B',12);
$pdf->Cell(70,20,"Cliente:",0,0,'L');
$pdf->setFont('arial','',12);
$pdf->Cell(70,20,$nome,0,1,'L');
//Defeito
$pdf->SetFont('arial','B',12);
$pdf->Cell(70,20,"Defeito:",0,0,'L');
$pdf->setFont('arial','',12);
$pdf->Cell(70,20,$descdefeito,0,1,'L');
//Situação
$pdf->SetFont('arial','B',12);
$pdf->Cell(70,20,"Situacao:",0,0,'L');
$pdf->setFont('arial','',12);
$pdf->Cell(70,20,$situacao,0,1,'L');
$pdf->Output("arquivo.pdf","D");
?>
FUNCCONCOP.JS
var req;
// Verificando Browser
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
}
else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
// Verificando Browser
if(window.XMLHttpRequest) {
req = new XMLHttpRequest();
}
else if(window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
}
67
req.send(null);
}
JQUERY.JS
/*!
* jQuery JavaScript Library v1.3.2
* http://jquery.com/
*
* Copyright (c) 2009 John Resig
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
* Revision: 6246
*/
(function(){
var
// Will speed up references to window, and allows munging its name.
window = this,
// Will speed up references to undefined, and allows munging its name.
undefined,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
jQuery.fn = jQuery.prototype = {
init: function( selector, context ) {
// Make sure that a selection was provided
selector = selector || document;
// Handle $(DOMElement)
if ( selector.nodeType ) {
this[0] = selector;
this.length = 1;
this.context = selector;
return this;
}
// Handle HTML strings
68
// HANDLE: $("#id")
else {
var elem = document.getElementById( match[3] );
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) )
return jQuery( document ).ready( selector );
ret.context = this.context;
return this;
},
else {
options = {};
options[ name ] = value;
}
return ret;
},
if ( this[0].parentNode )
wrap.insertBefore( this[0] );
wrap.map(function(){
var elem = this;
while ( elem.firstChild )
elem = elem.firstChild;
return elem;
}).append(this);
}
return this;
},
},
append: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.appendChild( elem );
});
},
prepend: function() {
return this.domManip(arguments, true, function(elem){
if (this.nodeType == 1)
this.insertBefore( elem, this.firstChild );
});
},
before: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this );
});
},
after: function() {
return this.domManip(arguments, false, function(elem){
this.parentNode.insertBefore( elem, this.nextSibling );
});
},
end: function() {
return this.prevObject || jQuery( [] );
},
} else {
return this.pushStack( jQuery.unique(jQuery.map(this,
function(elem){
return jQuery.find( selector, elem );
})), "find", selector );
}
},
ret.find("*").andSelf().each(function(){
if ( this.nodeName !== orig[i].nodeName )
return;
i++;
});
}
return this.map(function(){
var cur = this;
while ( cur && cur.ownerDocument ) {
if ( pos ? pos.index(cur) > -1 : jQuery(cur).is(selector) ) {
jQuery.data(cur, "closest", closer);
return cur;
}
cur = cur.parentNode;
closer++;
}
});
},
return this.filter(function() {
return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this !=
selector;
});
},
if ( elem ) {
if( jQuery.nodeName( elem, 'option' ) )
return (elem.attributes.value || {}).specified ?
elem.value : elem.text;
if ( option.selected ) {
// Get the specifc value for the option
76
value = jQuery(option).val();
return values;
}
return undefined;
}
return this.each(function(){
if ( this.nodeType != 1 )
return;
if ( !values.length )
this.selectedIndex = -1;
} else
this.value = value;
});
},
77
eq: function( i ) {
return this.slice( i, +i + 1 );
},
slice: function() {
return this.pushStack( Array.prototype.slice.apply( this, arguments ),
"slice", Array.prototype.slice.call(arguments).join(",") );
},
andSelf: function() {
return this.add( this.prevObject );
},
if ( first )
for ( var i = 0, l = this.length; i < l; i++ )
callback.call( root(this[i], first), this.length > 1 || i > 0
?
fragment.cloneNode(true) :
fragment );
if ( scripts )
jQuery.each( scripts, evalScript );
}
78
return this;
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
}
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
else
jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML ||
"" );
if ( elem.parentNode )
elem.parentNode.removeChild( elem );
}
function now(){
return +new Date;
}
jQuery.extend({
noConflict: function( deep ) {
window.$ = _$;
if ( deep )
80
window.jQuery = _jQuery;
return jQuery;
},
script.type = "text/javascript";
if ( jQuery.support.scriptEval )
script.appendChild( document.createTextNode( data ) );
else
script.text = data;
name.toUpperCase();
},
if ( args ) {
if ( length === undefined ) {
for ( name in object )
if ( callback.apply( object[ name ], args ) === false )
break;
} else
for ( ; i < length; )
if ( callback.apply( object[ i++ ], args ) === false )
break;
return object;
},
className: {
// internal only, use addClass("class")
add: function( elem, classNames ) {
jQuery.each((classNames || "").split(/\s+/), function(i, className)
{
82
if ( elem.nodeType == 1 && !
jQuery.className.has( elem.className, className ) )
elem.className += (elem.className ? " " : "") +
className;
});
},
callback.call( elem );
function getWH() {
val = name == "width" ? elem.offsetWidth :
83
elem.offsetHeight;
if ( elem.offsetWidth !== 0 )
getWH();
else
jQuery.swap( elem, props, getWH );
// Make sure we're using the right name for getting the float value
if ( name.match( /float/i ) )
name = styleFloat;
else if ( defaultView.getComputedStyle ) {
84
if ( computedStyle )
ret = computedStyle.getPropertyValue( name );
} else if ( elem.currentStyle ) {
var camelCase = name.replace(/\-(\w)/g, function(all, letter){
return letter.toUpperCase();
});
return ret;
},
if ( !elem )
return;
var wrap =
// option or optgroup
!tags.indexOf("<opt") &&
[ 1, "<select multiple='multiple'>", "</select>" ] ||
!tags.indexOf("<leg") &&
[ 1, "<fieldset>", "</fieldset>" ] ||
tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
86
[ 1, "<table>", "</table>" ] ||
!tags.indexOf("<tr") &&
[ 2, "<table><tbody>", "</tbody></table>" ] ||
!tags.indexOf("<col") &&
[ 2, "<table><tbody></tbody><colgroup>",
"</colgroup></table>" ] ||
[ 0, "", "" ];
if ( elem.nodeType )
ret.push( elem );
else
ret = jQuery.merge( ret, elem );
});
if ( fragment ) {
for ( var i = 0; ret[i]; i++ ) {
if ( jQuery.nodeName( ret[i], "script" ) && (!ret[i].type ||
ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ?
ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 )
ret.splice.apply( ret, [i + 1,
0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) );
fragment.appendChild( ret[i] );
}
}
return scripts;
}
return ret;
},
if ( set )
// convert the value to a string (all browsers do this but IE)
see #1070
elem.setAttribute( name, "" + value );
if ( set )
elem[ name ] = value;
},
return ret;
},
return -1;
},
} else
while ( (elem = second[ i++ ]) != null )
first[ pos++ ] = elem;
return first;
},
91
try {
if ( !done[ id ] ) {
done[ id ] = true;
ret.push( array[ i ] );
}
}
} catch( e ) {
ret = array;
}
return ret;
},
return ret;
},
if ( value != null )
ret[ ret.length ] = value;
}
jQuery.each({
parent: function(elem){return elem.parentNode;},
parents: function(elem){return jQuery.dir(elem,"parentNode");},
next: function(elem){return jQuery.nth(elem,2,"nextSibling");},
prev: function(elem){return jQuery.nth(elem,2,"previousSibling");},
nextAll: function(elem){return jQuery.dir(elem,"nextSibling");},
prevAll: function(elem){return jQuery.dir(elem,"previousSibling");},
siblings: function(elem){return
jQuery.sibling(elem.parentNode.firstChild,elem);},
children: function(elem){return jQuery.sibling(elem.firstChild);},
contents: function(elem){return jQuery.nodeName(elem,"iframe")?
elem.contentDocument||
elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}
}, function(name, fn){
jQuery.fn[ name ] = function( selector ) {
var ret = jQuery.map( this, fn );
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function(name, original){
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector );
jQuery.each({
removeAttr: function( name ) {
jQuery.attr( this, name, "" );
if (this.nodeType == 1)
this.removeAttribute( name );
},
empty: function() {
// Remove element nodes and prevent memory leaks
jQuery(this).children().remove();
}, function(name, fn){
jQuery.fn[ name ] = function(){
return this.each( fn, arguments );
};
});
jQuery.extend({
cache: {},
if ( jQuery.cache[ id ] ) {
// Remove the section of cache data
delete jQuery.cache[ id ][ name ];
if ( !name )
jQuery.removeData( elem );
}
if ( !q || jQuery.isArray(data) )
q = jQuery.data( elem, type, jQuery.makeArray(data) );
else if( data )
q.push( data );
}
return q;
},
jQuery.fn.extend({
data: function( key, value ){
var parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
return this.each(function(){
var queue = jQuery.queue( this, type, data );
});
},
dequeue: function(type){
return this.each(function(){
jQuery.dequeue( this, type );
});
}
});/*!
* Sizzle CSS Selector Engine - v0.9.3
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var parts = [], m, set, checkSet, check, mode, extra, prune = true;
if ( m[2] ) {
extra = RegExp.rightContext;
break;
}
}
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] )
selector += parts.shift();
if ( parts.length > 0 ) {
checkSet = makeArray(set);
} else {
prune = false;
}
while ( parts.length ) {
var cur = parts.pop(), pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
throw "Syntax error, unrecognized expression: " + (cur || selector);
}
99
if ( extra ) {
Sizzle( extra, context, results, seed );
if ( sortOrder ) {
hasDuplicate = false;
results.sort(sortOrder);
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[i-1] ) {
results.splice(i--, 1);
}
}
}
}
}
return results;
};
if ( !expr ) {
return [];
100
if ( !set ) {
set = context.getElementsByTagName("*");
}
if ( curLoop == result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop,
inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
101
if ( match ) {
for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i,
curLoop );
var pass = not ^ !!found;
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr == old ) {
if ( anyFound == null ) {
throw "Syntax error, unrecognized expression: " + expr;
} else {
break;
}
}
old = expr;
}
102
return curLoop;
};
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
103
}
},
">": function(checkSet, part, isXML){
var isPartStr = typeof part === "string";
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var doneName = done++, checkFn = dirCheck;
if ( !part.match(/\W/) ) {
var nodeCheck = part = isXML ? part :
part.toUpperCase();
checkFn = dirNodeCheck;
}
if ( isXML ) {
return match;
}
return false;
},
ID: function(match){
return match[1].replace(/\\/g, "");
},
TAG: function(match, curLoop){
for ( var i = 0; curLoop[i] === false; i++ ){}
return curLoop[i] && isXML(curLoop[i]) ? match[1] :
match[1].toUpperCase();
},
CHILD: function(match){
if ( match[1] == "nth" ) {
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1',
'-n+6'
var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
match[2] == "even" && "2n" || match[2] == "odd" &&
"2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] ||
match[2]);
return match;
},
ATTR: function(match, curLoop, inplace, result, not, isXML){
var name = match[1].replace(/\\/g, "");
return match;
},
PSEUDO: function(match, curLoop, inplace, result, not){
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple
one
if ( match[3].match(chunker).length > 1 ||
106
/^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace,
true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) ||
Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function(match){
match.unshift( true );
return match;
}
},
filters: {
enabled: function(elem){
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function(elem){
return elem.disabled === true;
},
checked: function(elem){
return elem.checked === true;
},
selected: function(elem){
// Accessing this property makes selected-by-default
// options in Safari work properly
elem.parentNode.selectedIndex;
return elem.selected === true;
},
parent: function(elem){
return !!elem.firstChild;
},
empty: function(elem){
return !elem.firstChild;
},
has: function(elem, i, match){
return !!Sizzle( match[3], elem ).length;
},
header: function(elem){
return /h\d/i.test( elem.nodeName );
},
107
text: function(elem){
return "text" === elem.type;
},
radio: function(elem){
return "radio" === elem.type;
},
checkbox: function(elem){
return "checkbox" === elem.type;
},
file: function(elem){
return "file" === elem.type;
},
password: function(elem){
return "password" === elem.type;
},
submit: function(elem){
return "submit" === elem.type;
},
image: function(elem){
return "image" === elem.type;
},
reset: function(elem){
return "reset" === elem.type;
},
button: function(elem){
return "button" === elem.type || elem.nodeName.toUpperCase()
=== "BUTTON";
},
input: function(elem){
return /input|select|textarea|button/i.test(elem.nodeName);
}
},
setFilters: {
first: function(elem, i){
return i === 0;
},
last: function(elem, i, match, array){
return i === array.length - 1;
},
even: function(elem, i){
return i % 2 === 0;
},
odd: function(elem, i){
return i % 2 === 1;
},
lt: function(elem, i, match){
return i < match[3] - 0;
},
gt: function(elem, i, match){
return i > match[3] - 0;
108
},
nth: function(elem, i, match){
return match[3] - 0 == i;
},
eq: function(elem, i, match){
return match[3] - 0 == i;
}
},
filter: {
PSEUDO: function(elem, match, i, array){
var name = match[1], filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText ||
"").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
return true;
}
},
CHILD: function(elem, match){
var type = match[1], node = elem;
switch (type) {
case 'only':
case 'first':
while (node = node.previousSibling) {
if ( node.nodeType === 1 ) return false;
}
if ( type == 'first') return true;
node = elem;
case 'last':
while (node = node.nextSibling) {
if ( node.nodeType === 1 ) return false;
}
return true;
case 'nth':
var first = match[2], last = match[3];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
return ret;
};
}
var sortOrder;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
} else if ( "sourceIndex" in document.documentElement ) {
sortOrder = function( a, b ) {
var ret = a.sourceIndex - b.sourceIndex;
if ( ret === 0 ) {
hasDuplicate = true;
}
return ret;
};
} else if ( document.createRange ) {
sortOrder = function( a, b ) {
var aRange = a.ownerDocument.createRange(), bRange =
b.ownerDocument.createRange();
aRange.selectNode(a);
aRange.collapse(true);
bRange.selectNode(b);
bRange.collapse(true);
112
// Inject it into the root element, check its status, and remove it quickly
var root = document.documentElement;
root.insertBefore( form, root.firstChild );
root.removeChild( form );
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
div.appendChild( document.createComment("") );
results = tmp;
}
return results;
};
}
if ( document.querySelectorAll ) (function(){
var oldSizzle = Sizzle, div = document.createElement("div");
div.innerHTML = "<p class='TEST'></p>";
try {
return makeArray( context.querySelectorAll(query),
extra );
} catch(e){}
}
Sizzle.find = oldSizzle.find;
Sizzle.filter = oldSizzle.filter;
Sizzle.selectors = oldSizzle.selectors;
Sizzle.matches = oldSizzle.matches;
})();
if ( document.getElementsByClassName &&
document.documentElement.getElementsByClassName ) (function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
if ( div.getElementsByClassName("e").length === 1 )
return;
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function(match, context, isXML) {
if ( typeof context.getElementsByClassName !== "undefined" && !
isXML ) {
return context.getElementsByClassName(match[1]);
}
};
})();
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
while ( elem ) {
if ( elem.sizcache === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem.sizcache = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
116
match = true;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
// EXPOSE
jQuery.find = Sizzle;
jQuery.filter = Sizzle.filter;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
Sizzle.selectors.filters.hidden = function(elem){
return elem.offsetWidth === 0 || elem.offsetHeight === 0;
};
Sizzle.selectors.filters.visible = function(elem){
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
};
Sizzle.selectors.filters.animated = function(elem){
return jQuery.grep(jQuery.timers, function(fn){
return elem === fn.elem;
}).length;
};
return cur;
};
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType == 1 && n != elem )
r.push( n );
}
return r;
};
return;
window.Sizzle = Sizzle;
})();
/*
* A number of helper functions used for managing events.
* Many of the ideas behind this code originated from
* Dean Edwards' addEvent library.
*/
jQuery.event = {
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].setup.call(elem, data,
namespaces);
guid: 1,
global: {},
if ( events ) {
// Unbind all events for the element
if ( types === undefined || (typeof types === "string" &&
types.charAt(0) == ".") )
for ( var type in events )
this.remove( elem, type + (types || "") );
else {
// types is actually an event object here
if ( types.type ) {
handler = types.handler;
types = types.type;
}
if ( events[type] ) {
// remove the given handler for the given
type
if ( handler )
delete events[type][handler.guid];
121
if ( jQuery.event.specialAll[type] )
jQuery.event.specialAll[type].teardown.call(elem, namespaces);
// bubbling is internal
trigger: function( event, data, elem, bubbling ) {
// Event object or event type
var type = event.type || event;
122
if( !bubbling ){
event = typeof event === "object" ?
// jQuery.Event object
event[expando] ? event :
// Object literal
jQuery.extend( jQuery.Event(type), event ) :
// Just the event type (string)
jQuery.Event(type);
if ( type.indexOf("!") >= 0 ) {
event.type = type = type.slice(0, -1);
event.exclusive = true;
}
event.currentTarget = elem;
this.triggered = false;
if ( !event.isPropagationStopped() ) {
var parent = elem.parentNode || elem.ownerDocument;
if ( parent )
jQuery.event.trigger(event, data, parent, true);
}
},
handle: function(event) {
// returned undefined or false
var all, handlers;
if( event.isImmediatePropagationStopped() )
break;
}
}
},
fix: function(event) {
if ( event[expando] )
return event;
// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for
Macs)
if ( !event.metaKey && event.ctrlKey )
event.metaKey = event.ctrlKey;
return event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: bindReady,
teardown: function() {}
}
},
126
specialAll: {
live: {
setup: function( selector, namespaces ){
jQuery.event.add( this, namespaces[0], liveHandler );
},
teardown: function( namespaces ){
if ( namespaces.length ) {
var remove = 0, name = RegExp("(^|\\.)" +
namespaces[0] + "(\\.|$)");
if ( remove < 1 )
jQuery.event.remove( this, namespaces[0],
liveHandler );
}
}
}
}
};
// Event object
if( src && src.type ){
this.originalEvent = src;
this.type = src.type;
// Event type
}else
this.type = src;
// Mark it as fixed
this[expando] = true;
};
function returnFalse(){
return false;
}
127
function returnTrue(){
return true;
}
var e = this.originalEvent;
if( !e )
return;
// if preventDefault exists run it on the original event
if (e.preventDefault)
e.preventDefault();
// otherwise set the returnValue property of the original event to false
(IE)
e.returnValue = false;
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if( !e )
return;
// if stopPropagation exists run it on the original event
if (e.stopPropagation)
e.stopPropagation();
// otherwise set the cancelBubble property of the original event to true
(IE)
e.cancelBubble = true;
},
stopImmediatePropagation:function(){
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Checks if an event happened on an element within another element
// Used in jQuery.event.special.mouseenter and mouseleave handlers
var withinElement = function(event) {
// Check if mouse(over|out) are still within the same parent element
var parent = event.relatedTarget;
// Traverse up the tree
while ( parent && parent != this )
128
jQuery.each({
mouseover: 'mouseenter',
mouseout: 'mouseleave'
}, function( orig, fix ){
jQuery.event.special[ fix ] = {
setup: function(){
jQuery.event.add( this, orig, withinElement, fix );
},
teardown: function(){
jQuery.event.remove( this, orig, withinElement );
}
};
});
jQuery.fn.extend({
bind: function( type, data, fn ) {
return type == "unload" ? this.one(type, data, fn) : this.each(function(){
jQuery.event.add( this, type, fn || data, fn && data );
});
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments, i = 1;
// link all the functions, so any of them can unbind this click handler
while( i < args.length )
jQuery.event.proxy( fn, args[i++] );
ready: function(fn) {
// Attach the listeners
bindReady();
jQuery.readyList.push( fn );
return this;
},
return this;
},
elems.sort(function(a,b) {
return jQuery.data(a.elem, "closest") - jQuery.data(b.elem, "closest");
});
jQuery.each(elems, function(){
if ( this.fn.call(this.elem, event, this.fn.data) === false )
return (stop = false);
});
return stop;
}
jQuery.extend({
isReady: false,
readyList: [],
// Handle when the DOM is ready
ready: function() {
// Make sure that the DOM is not already loaded
if ( !jQuery.isReady ) {
// Remember that the DOM is ready
jQuery.isReady = true;
function bindReady(){
if ( readyBound ) return;
readyBound = true;
arguments.callee );
jQuery.ready();
}
});
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch( error ) {
setTimeout( arguments.callee, 0 );
return;
}
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouse
leave," +
"change,select,submit,keydown,keypress,keyup,error").split(","), function(i,
name){
(function(){
jQuery.support = {};
div.style.display = "none";
div.innerHTML = ' <link/><table></table><a href="/a"
style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><o
bject><param/></object>';
jQuery.support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: div.firstChild.nodeType == 3,
// Make sure that you can get all elements in an <object> element
// IE 7 always returns no results
objectAll: !!div.getElementsByTagName("object")[0]
.getElementsByTagName("*").length,
script.type = "text/javascript";
try {
script.appendChild( document.createTextNode( "window." + id +
"=1;" ) );
} catch(e){}
root.removeChild( script );
document.body.appendChild( div );
jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2;
document.body.removeChild( div ).style.display = 'none';
});
})();
135
jQuery.props = {
"for": "htmlFor",
"class": "className",
"float": styleFloat,
cssFloat: styleFloat,
styleFloat: styleFloat,
readonly: "readOnly",
maxlength: "maxLength",
cellspacing: "cellSpacing",
rowspan: "rowSpan",
tabindex: "tabIndex"
};
jQuery.fn.extend({
// Keep a copy of the old load
_load: jQuery.fn.load,
url: url,
type: type,
dataType: "html",
data: params,
complete: function(res, status){
// If successful, inject the HTML into all the matched
elements
if ( status == "success" || status == "notmodified" )
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div/>")
// inject the contents of the document
in, removing the scripts
// to avoid any 'Permission Denied'
errors in IE
.append(res.responseText.replace(/<
script(.|\s)*?\/script>/g, ""))
if( callback )
self.each( callback, [res.responseText, status,
res] );
}
});
return this;
},
serialize: function() {
return jQuery.param(this.serializeArray());
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray(this.elements) : this;
})
.filter(function(){
return this.name && !this.disabled &&
(this.checked || /select|textarea/i.test(this.nodeName) ||
/text|hidden|password|search/i.test(this.type));
})
.map(function(i, elem){
var val = jQuery(this).val();
return val == null ? null :
jQuery.isArray(val) ?
jQuery.map( val, function(val, i){
137
jQuery.extend({
return jQuery.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
},
return jQuery.ajax({
138
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
},
ajaxSettings: {
url: location.href,
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
username: null,
password: null,
*/
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7, so we use the ActiveXObject
when it is available
// This function can be overriden by calling jQuery.ajaxSetup
xhr:function(){
return window.ActiveXObject ? new
ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
},
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
script: "text/javascript, application/javascript",
json: "application/json, text/javascript",
text: "text/plain",
_default: "*/*"
}
},
ajax: function( s ) {
// Extend the settings, but re-extend 's' so that it can be
// checked again later (in the test suite, specifically)
s = jQuery.extend(true, s, jQuery.extend(true, {}, jQuery.ajaxSettings,
139
s));
// Replace the =? sequence both in the query string and the data
if ( s.data )
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
head.appendChild(script);
if ( s.global )
jQuery.event.trigger("ajaxSend", [xhr, s]);
if ( status == "success" ) {
// Watch for, and catch, XML document parse
errors
try {
// process the data (runs the xml through
httpData regardless of callback)
143
if ( isTimeout )
xhr.abort();
if ( s.async ) {
// don't attach the handler to the request, just poll it instead
var ival = setInterval(onreadystatechange, 13);
// Timeout checker
if ( s.timeout > 0 )
setTimeout(function(){
// Check to see if the request is still happening
if ( xhr && !requestDone )
onreadystatechange( "timeout" );
}, s.timeout);
}
144
function success(){
// If a local callback was specified, fire it and pass it the data
if ( s.success )
s.success( data, status );
function complete(){
// Process result
if ( s.complete )
s.complete(xhr, status);
active: 0,
return data;
},
});
var elemdisplay = {},
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop",
"paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
];
147
jQuery.fn.extend({
show: function(speed,callback){
if ( speed ) {
return this.animate( genFx("show", 3), speed, callback);
} else {
for ( var i = 0, l = this.length; i < l; i++ ){
var old = jQuery.data(this[i], "olddisplay");
if ( elemdisplay[ tagName ] ) {
display = elemdisplay[ tagName ];
} else {
var elem = jQuery("<" + tagName + "
/>").appendTo("body");
display = elem.css("display");
if ( display === "none" )
display = "block";
elem.remove();
return this;
}
},
148
hide: function(speed,callback){
if ( speed ) {
return this.animate( genFx("hide", 3), speed, callback);
} else {
for ( var i = 0, l = this.length; i < l; i++ ){
var old = jQuery.data(this[i], "olddisplay");
if ( !old && old !== "none" )
jQuery.data(this[i], "olddisplay", jQuery.css(this[i],
"display"));
}
return this;
}
},
fadeTo: function(speed,to,callback){
return this.animate({opacity: to}, speed, callback);
},
for ( p in prop ) {
if ( prop[p] == "hide" && hidden || prop[p] == "show" && !
hidden )
return opt.complete.call(this);
if ( opt.overflow != null )
this.style.overflow = "hidden";
if ( /toggle|show|hide/.test(val) )
e[ val == "toggle" ? hidden ? "show" : "hide" : val ]
( prop );
else {
var parts = val.toString().match(/^([+-]=)?([\d+-.]+)
(.*)$/),
start = e.cur(true) || 0;
if ( parts ) {
var end = parseFloat(parts[2]),
unit = parts[3] || "px";
if (clearQueue)
this.queue([]);
this.each(function(){
// go in reverse order so anything added to the queue during the
loop is ignored
for ( var i = timers.length - 1; i >= 0; i-- )
if ( timers[i].elem == this ) {
if (gotoEnd)
// force the next step to be the last
timers[i](true);
timers.splice(i, 1);
}
});
// start the next in the queue if the last step wasn't forced
if (!gotoEnd)
this.dequeue();
return this;
}
});
jQuery.extend({
151
// Queueing
opt.old = opt.complete;
opt.complete = function(){
if ( opt.queue !== false )
jQuery(this).dequeue();
if ( jQuery.isFunction( opt.old ) )
opt.old.call( this );
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
}
},
timers: [],
if ( !options.orig )
options.orig = {};
}
});
jQuery.fx.prototype = {
152
t.elem = this.elem;
if ( !timers.length ) {
clearInterval( timerId );
timerId = undefined;
153
}
}, 13);
}
},
if ( done ) {
if ( this.options.display != null ) {
// Reset the overflow
154
this.elem.style.overflow = this.options.overflow;
return false;
} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
return true;
}
};
jQuery.extend( jQuery.fx, {
speeds:{
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
155
opacity: function(fx){
jQuery.attr(fx.elem.style, "opacity", fx.now);
},
_default: function(fx){
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null )
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
else
fx.elem[ fx.prop ] = fx.now;
}
}
});
if ( document.documentElement["getBoundingClientRect"] )
jQuery.fn.offset = function() {
if ( !this[0] ) return { top: 0, left: 0 };
if ( this[0] === this[0].ownerDocument.body ) return
jQuery.offset.bodyOffset( this[0] );
var box = this[0].getBoundingClientRect(), doc =
this[0].ownerDocument, body = doc.body, docElem = doc.documentElement,
clientTop = docElem.clientTop || body.clientTop || 0, clientLeft =
docElem.clientLeft || body.clientLeft || 0,
top = box.top + (self.pageYOffset || jQuery.boxModel &&
docElem.scrollTop || body.scrollTop ) - clientTop,
left = box.left + (self.pageXOffset || jQuery.boxModel &&
docElem.scrollLeft || body.scrollLeft) - clientLeft;
return { top: top, left: left };
};
else
jQuery.fn.offset = function() {
if ( !this[0] ) return { top: 0, left: 0 };
if ( this[0] === this[0].ownerDocument.body ) return
jQuery.offset.bodyOffset( this[0] );
jQuery.offset.initialized || jQuery.offset.initialize();
while ( (elem = elem.parentNode) && elem !== body && elem !==
docElem ) {
computedStyle = defaultView.getComputedStyle(elem, null);
top -= elem.scrollTop, left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop, left += elem.offsetLeft;
156
if ( jQuery.offset.doesNotAddBorder && !
(jQuery.offset.doesAddBorderForTableAndCells && /^t(able|d|h)
$/i.test(elem.tagName)) )
top += parseInt( computedStyle.borderTopWidth,
10) || 0,
left += parseInt( computedStyle.borderLeftWidth,
10) || 0;
prevOffsetParent = offsetParent, offsetParent =
elem.offsetParent;
}
if ( jQuery.offset.subtractsBorderForOverflowNotVisible &&
computedStyle.overflow !== "visible" )
top += parseInt( computedStyle.borderTopWidth, 10) ||
0,
left += parseInt( computedStyle.borderLeftWidth, 10) || 0;
prevComputedStyle = computedStyle;
}
jQuery.offset = {
initialize: function() {
if ( this.initialized ) return;
var body = document.body, container = document.createElement('div'),
innerDiv, checkDiv, table, td, rules, prop, bodyMarginTop = body.style.marginTop,
html = '<div
style="position:absolute;top:0;left:0;margin:0;border:5px solid
#000;padding:0;width:1px;height:1px;"><div></div></div><table
style="position:absolute;top:0;left:0;margin:0;border:5px solid
#000;padding:0;width:1px;height:1px;" cellpadding="0"
cellspacing="0"><tr><td></td></tr></table>';
container.innerHTML = html;
body.insertBefore(container, body.firstChild);
innerDiv = container.firstChild, checkDiv = innerDiv.firstChild, td =
innerDiv.nextSibling.firstChild.firstChild;
157
body.style.marginTop = '1px';
this.doesNotIncludeMarginInBodyOffset = (body.offsetTop === 0);
body.style.marginTop = bodyMarginTop;
body.removeChild(container);
this.initialized = true;
},
bodyOffset: function(body) {
jQuery.offset.initialized || jQuery.offset.initialize();
var top = body.offsetTop, left = body.offsetLeft;
if ( jQuery.offset.doesNotIncludeMarginInBodyOffset )
top += parseInt( jQuery.curCSS(body, 'marginTop', true), 10 ) ||
0,
left += parseInt( jQuery.curCSS(body, 'marginLeft', true), 10 ) ||
0;
return { top: top, left: left };
}
};
jQuery.fn.extend({
position: function() {
var left = 0, top = 0, results;
if ( this[0] ) {
// Get *real* offsetParent
var offsetParent = this.offsetParent(),
return results;
},
offsetParent: function() {
var offsetParent = this[0].offsetParent || document.body;
while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) &&
jQuery.css(offsetParent, 'position') == 'static') )
offsetParent = offsetParent.offsetParent;
return jQuery(offsetParent);
}
});
});
// Create innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function(i, name){
});
})();
STILO.CSS
body {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 13px;
color: #000;
}
img{
border:0px;
}
fieldset{
//width:450px;
border-bottom:4px solid #666;
border-right:4px solid #666;
}
label{
color:#000;
}
#status {
padding: 5px 0 15px 0;
display: none;
color: #900;
font-weight: bold;
}
.fundolabel{
background-color: #f0f0f0;
}
.legendfield{
161
font-size: 18px;
font-family: verdana;
background:#295696;
color:#ffffff;
margin-left: 10px;
}
.td{
background:#295696;
}
td{
color:#000;
}
th{
font-family:tahoma;
font-size:16px;
background:#009acd;
color:#000066;
text-decoration:none;
font-weight:normal;
text-indent:4px;
height:30px
}
a:link {
color: #999;
}
a:visited {
color: #999;
}
a:hover {
color: #999;
font-weight: bold;
}
a:active {
color: #999;
}
#conteudo {
width: 400px;
text-align:justify;
}
#saudacao{
padding-top:5px;
162
margin-bottom:3px;
height:25px;
border-bottom:dotted 1px;
background:#009;
color:#FFF;
}
#escrever{
background:#bcd2ee;
}
#topo{
background:#CCC;
}
CADCLIF.PHP
<?php require_once("../libs/conn.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastro de Clientes</title>
<!-- Incluimos a biblioteca do jquery -->
<script type="text/javascript" language="javascript" src="../libs/jquery.js"></script>
<!-- Incluimos a folha de estilo css -->
<link type="text/css" rel="stylesheet" href="../libs/stilo.css">
<!-- Criamos as funções necessárias para envio do formulário -->
<script type="text/javascript" language="javascript">
$(function($) {
// Quando o formulário for enviado, essa função é chamada
$("#formulario").submit(function() {
// Colocamos os valores de cada campo em uma váriavel para facilitar
a manipulação
var cpf = $("#cpf").val();
var rg = $("#rg").val();
var nome = $("#nome").val();
var cnpj = $("#cnpj").val();
var rsocial = $("#rsocial").val();
var nfantasia = $("#nfantasia").val();
var endereco = $("#endereco").val();
var numero = $("#numero").val();
var complemento = $("#complemento").val();
var telefone1 = $("#telefone1").val();
var telefone2 = $("#telefone2").val();
var email = $("#email").val();
var cidade = $("#cidade").val();
var senha = $("#senha").val();
// Exibe mensagem de carregamento
$("#status").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requisão ajax p e enviamos os valores de cada campo
163
}
});
});
});
</script>
// Divs 1 e 3
$("#dpfisica").hide();
$("#pfisica").click(function () {
164
$("#dpfisica").slideToggle("slow");
});
// Div 2
$("#dpjuridica").hide();
$("#pjuridica").click(function () {
$("#dpjuridica").slideToggle("slow");
});
});
</script>
</head>
<body>
<div id="escrever">
<fieldset>
<legend class="legendfield">Cadastro de Clientes</legend>
<!-- Div que mostra as mensagens de confirmação e erro -->
<div id="status"></div>
<div>
<form id="formulario" action="javascript:func()" method="post">
<br />
<fieldset><legend>Escolha um Tipo:</legend>
<input type="radio" name="tcliente" id="pfisica" />Pessoa Fisica
<input type="radio" name="tcliente" id="pjuridica">Pessoa Juridica
</fieldset><br />
<div id="dpfisica">
<table>
<tr><td class="fundolabel"><label
for="cpf"><strong>CPF:</strong></label></td>
<td><input name="cpf" type="text" id="cpf" size="15" maxlength="11" />
</td></tr>
<tr><td class="fundolabel"><label
for="rg"><strong>RG:</strong></label></td>
<td><input name="rg" type="text" id="rg" size="15" maxlength="10" /> </td></tr>
<tr><td class="fundolabel"><label
for="nome"><strong>Nome:</strong></label></td>
<td><input name="nome" type="text" id="nome" size="40" /> </td></tr>
<tr><td class="fundolabel"><label
for="endereco"><strong>Endereço:</strong></label></td>
<td><input name="endereco" type="text" id="endereco" size="40" /></td>
<tr><td class="fundolabel"><label
for="numero"><strong>Número:</strong></label></td>
<td><input name="numero" type="text" id="numero" size="5" maxlength="5"
/></td></tr>
<tr><td class="fundolabel"><label
165
for="complemento"><strong>Complemento:</strong></label></td>
<td><input name="complemento" type="text" id="complemento" size="15"
/></td></tr>
<tr><td class="fundolabel"><label
for="telefone1"><strong>Telefone1:</strong></label></td>
<td><input name="telefone1" type="text" id="telefone1" size="15"
maxlength="15" /></td></tr>
<tr><td class="fundolabel"><label
for="telefone2"><strong>Telefone2:</strong></label></td>
<td><input name="telefone2" type="text" id="telefone2" size="15"
maxlength="15" /></td></tr>
<tr><td class="fundolabel"><label
for="email"><strong>Email:</strong></label></td>
<td><input name="email" type="text" id="email" size="30" /></td></tr>
<tr><td class="fundolabel"><label
for="cidade"><strong>Cidade:</strong></label></td>
<td><select name="cidade" id="cidade">
<option value="Indefinida">Selecione uma Cidade</option>
<option value="Alegrete">Alegrete</option>
<option value="Manoel Viana">Manoel Viana</option>
<option value="Itaqui">Itaqui</option>
<option value="Quarai">Quarai</option>
<option value="Sao Borja">São Borja</option>
<option value="Santana do Livramento">Santana do
Livramento</option>
<option value="Uruguaiana">Uruguaiana</option>
</td></tr>
<tr><td class="fundolabel"><label
for="senha"><strong>Senha:</strong></label></td>
<td><input name="senha" type="password" id="senha" size="20"
maxlength="10" /></td></tr>
</table>
</div>
<div id="dpjuridica">
<table>
<tr><td class="fundolabel"><label
for="cnpj"><strong>CNPJ:</strong></label></td>
<td><input name="cnpj" type="text" id="cnpj" size="20" maxlength="15" />
</td></tr>
166
<tr><td class="fundolabel"><label
for="endereco"><strong>Endereço:</strong></label></td>
<td><input name="endereco" type="text" id="endereco" size="40" /></td>
<tr><td class="fundolabel"><label
for="numero"><strong>Número:</strong></label></td>
<td><input name="numero" type="text" id="numero" size="5" maxlength="5"
/></td></tr>
<tr><td class="fundolabel"><label
for="complemento"><strong>Complemento:</strong></label></td>
<td><input name="complemento" type="text" id="complemento" size="15"
/></td></tr>
<tr><td class="fundolabel"><label
for="telefone1"><strong>Telefone1:</strong></label></td>
<td><input name="telefone1" type="text" id="telefone1" size="15"
maxlength="15" /></td></tr>
<tr><td class="fundolabel"><label
for="telefone2"><strong>Telefone2:</strong></label></td>
<td><input name="telefone2" type="text" id="telefone2" size="15"
maxlength="15" /></td></tr>
<tr><td class="fundolabel"><label
for="email"><strong>Email:</strong></label></td>
<td><input name="email" type="text" id="email" size="30" /></td></tr>
<tr><td class="fundolabel"><label
for="cidade"><strong>Cidade:</strong></label></td>
<td><select name="cidade" id="cidade">
<option value="Indefinida">Selecione uma Cidade</option>
<option value="Alegrete">Alegrete</option>
<option value="Manoel Viana">Manoel Viana</option>
<option value="Itaqui">Itaqui</option>
<option value="Quarai">Quarai</option>
<option value="Sao Borja">São Borja</option>
<option value="Santana do Livramento">Santana do
Livramento</option>
<option value="Uruguaiana">Uruguaiana</option>
167
</td></tr>
<tr><td class="fundolabel"><label
for="senha"><strong>Senha:</strong></label></td>
<td><input name="senha" type="password" id="senha" size="20"
maxlength="10" /></td></tr>
</table>
</div>
<br />
<center>
<input type="submit" value="Salvar" />
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</fieldset>
</div>
</body>
</html>
CADCOP.PHP
<?php require_once("../libs/conn.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastro de Copiadoras</title>
<!-- Incluimos a biblioteca do jquery -->
<script type="text/javascript" language="javascript" src="../libs/jquery.js"></script>
<!-- Incluimos a folha de estilo css -->
<link type="text/css" rel="stylesheet" href="../libs/stilo.css">
<!-- Criamos as funções necessárias para envio do formulário -->
<script type="text/javascript" language="javascript">
$(function($) {
// Quando o formulário for enviado, essa função é chamada
$("#formulario").submit(function() {
// Colocamos os valores de cada campo em uma váriavel para facilitar
a manipulação
var nserie = $("#nserie").val();
var modelo = $("#modelo").val();
var numerador = $("#numerador").val();
// Exibe mensagem de carregamento
$("#status").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requisão ajax com o arquivo tratacadcop.php e enviamos
os valores de cada campo através do método POST
$.post('tratacadcop.php', {nserie: nserie, modelo: modelo, numerador:
numerador }, function(resposta) {
// Quando terminada a requisição
// Exibe a div status
168
$("#status").slideDown();
// Se a resposta é um erro
if (resposta != false) {
// Exibe o erro na div
$("#status").html(resposta);
}
// Se resposta for false, ou seja, não ocorreu nenhum erro
else {
// Exibe mensagem de sucesso
$("#status").html("Cadastro Efetuado com
Sucesso!");
// Limpando todos os campos
$("#nserie").val("");
$("#modelo").val("");
$("#numerador").val("");
}
});
});
});
</script>
</head>
<body>
<div id="escrever">
<fieldset>
<legend class="legendfield">Cadastro de Copiadoras</legend>
<!-- Div que mostra as mensagens de confirmação e erro -->
<div id="status"></div>
<form id="formulario" action="javascript:func()" method="post">
<br />
<table>
<tr><td class="fundolabel"><label for="lnserie"><strong>Nº
Série:</strong></label></td>
<td><input name="nserie" type="text" id="nserie" size="25" /> </td></tr>
<tr><td class="fundolabel"><label
for="lmodelo"><strong>Modelo:</strong></label></td>
<td><input name="modelo" type="text" id="modelo" size="25" /> </td></tr>
<tr><td class="fundolabel"><label
for="lnumerador"><strong>Numerador:</strong></label></td>
<td><input name="numerador" type="text" id="numerador" size="8"
/></td></tr>
</table> <br />
<center>
<input type="submit" value="Salvar" />
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</fieldset>
</div>
169
</body>
</html>
CADFUNC.PHP
<?php require_once("../libs/conn.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cadastro de Funcionários</title>
<!-- Incluimos a biblioteca do jquery -->
<script type="text/javascript" language="javascript" src="../libs/jquery.js"></script>
<!-- Incluimos a folha de estilo css -->
<link type="text/css" rel="stylesheet" href="../libs/stilo.css">
<!-- Criamos as funções necessárias para envio do formulário -->
<script type="text/javascript" language="javascript">
$(function($) {
// Quando o formulário for enviado, essa função é chamada
$("#formulario").submit(function() {
// Colocamos os valores de cada campo em uma váriavel para facilitar
a manipulação
var nome = $("#nome").val();
var endereco = $("#endereco").val();
var numero = $("#numero").val();
var complemento = $("#complemento").val();
var telefone1 = $("#telefone1").val();
var telefone2 = $("#telefone2").val();
var dnasc = $("#dnasc").val();
var cpf = $("#cpf").val();
var rg = $("#rg").val();
var email = $("#email").val();
var categoria = $("#categoria").val();
var senha = $("#senha").val();
// Exibe mensagem de carregamento
$("#status").html("<img src='../img/loader.gif' alt='Enviando' />");
// Fazemos a requisão ajax p e enviamos os valores de cada campo
através do método POST
$.post('tratacadfunc.php', {nome: nome, endereco: endereco, numero:
numero, complemento: complemento, telefone1: telefone1, telefone2: telefone2,
dnasc: dnasc, cpf: cpf, rg: rg, email: email, categoria: categoria, senha: senha },
function(resposta) {
// Quando terminada a requisição
// Exibe a div status
$("#status").slideDown();
// Se a resposta é um erro
if (resposta != false) {
// Exibe o erro na div
$("#status").html(resposta);
}
170
<body>
<div id="escrever">
<fieldset>
<legend class="legendfield">Cadastro de Funcionários</legend>
<!-- Div que mostra as mensagens de confirmação e erro -->
<div id="status"></div>
<form id="formulario" action="javascript:func()" method="post">
<br />
<table>
<tr><td class="fundolabel"><label
for="nome"><strong>Nome:</strong></label></td>
<td><input name="nome" type="text" id="nome" size="40" /> </td></tr>
<tr><td class="fundolabel"><label
for="endereco"><strong>Endereço:</strong></label></td>
<td><input name="endereco" type="text" id="endereco" size="40" /></td>
<td class="fundolabel"><label
for="numero"><strong>Número:</strong></label></td>
<td><input name="numero" type="text" id="numero" size="5" maxlength="5"
/></td></tr>
<tr><td class="fundolabel"><label
for="complemento"><strong>Complemento:</strong></label></td>
171
<tr><td class="fundolabel"><label
for="telefone1"><strong>Telefone1:</strong></label></td>
<td><input name="telefone1" type="text" id="telefone1" size="15"
maxlength="15" /></td></tr>
<tr><td class="fundolabel"><label
for="telefone2"><strong>Telefone2:</strong></label></td>
<td><input name="telefone2" type="text" id="telefone2" size="15"
maxlength="15" /></td></tr>
><tr><td class="fundolabel"><label
for="cpf"><strong>CPF:</strong></label></td>
<td><input name="cpf" type="text" id="cpf" size="15" maxlength="11" />
</td></tr>
<tr><td class="fundolabel"><label
for="rg"><strong>RG:</strong></label></td>
<td><input name="rg" type="text" id="rg" size="15" maxlength="10" /> </td></tr>
<tr><td class="fundolabel"><label
for="email"><strong>Email:</strong></label></td>
<td><input name="email" type="text" id="email" size="30" /></td></tr>
<tr><td class="fundolabel"><label
for="categoria"><strong>Categoria:</strong></label></td>
<td><select name="categoria" id="categoria">
<option value="secretaria">Secretária</option>
<option value="tecnico">Técnico</option>
<option value="vendedor">Vendedor</option>
</td></tr>
<tr><td class="fundolabel"><label
for="senha"><strong>Senha:</strong></label></td>
<td><input name="senha" type="text" id="senha" size="20"
maxlength="10" /></td></tr>
172
</body>
</html>
ENCATECNICO.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("../libs/conn.php");
@session_start();
?>
}
// Se resposta for false, ou seja, n�o ocorreu nenhum
erro
else {
// Exibe mensagem de sucesso
$("#statusn").html("Cadastro Efetuado com
Sucesso!");
// Limpando todos os campos
$("#nota").val("");
}
});
});
});
</script>
</head>
<body>
<br/ >
<div>
<form id="formulario" action="javascript:func()" method="post">
<fieldset>
<legend>Encaminha Chamado a Tecnico!</legend>
<div id="statusn"></div>
<table width="850" align="center" bgcolor="#F4FFF4">
<tr>
<td width="14" height="22" bordercolor="#003300" bgcolor="#295696"><div
align="center" class="style13 style1">N°</div></td>
<td width="166" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">NOME</div></td>
<td width="165" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">DEFEITO</div></td>
<td width="92" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">SITUAÇÃO</div></td>
<td width="22" bordercolor="#003300" bgcolor="#295696"><div align="center"
class="style13 style1">TECNICO</div></td>
<?php
$sql = "select id,nome,descdefeito,situacao from chamados WHERE
nome = '$nome'";
$resultado = mysql_query($sql) or die (mysql_error());
while ($linha = mysql_fetch_array($resultado)){
echo "<tr>";
echo '<td align="center">';
echo $linha["id"];
echo '</td>';
echo '<td align="center">';
echo $linha["nome"];
echo '</td>';
echo '<td align="center">';
174
echo $linha["descdefeito"];
echo '</td>';
echo '<td align="center">';
echo $linha["situacao"];
echo '</td>';
echo '</tr>';
}
echo '</table>';
?>
</fieldset>
<br /><center>
<input type="submit" value="Salvar" >
<input type="reset" name="Reset" value="Cancelar"><br /><br /></center>
</form>
</div>
</body>
</html>
INFO.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<p> </p>
<p align="center"><b><font color="#FF0000" face="Verdana" size="2">
Você não está conectado no site.</font></b></p>
@session_start();
?>
<body>
<table width="788" border="0" align="center">
<tr>
<td colspan="5"><div align="center"><span class="style3">Dados
Gerênciais </span></div></td>
</tr>
<td colspan="5"><hr /></td>
<tr>
<td colspan="2"><div align="center"><span class="style3">Total de
Usuários
:
<?php
$sql = mysql_query("SELECT count(*) FROM usuarios");
echo mysql_result($sql, 0, 0); ?>
</span></div></td>
<td colspan="3"><div align="center"><span class="style3">Total de
Chamados:<span class="style7">
<?php
$sql = mysql_query("SELECT count(*) FROM chamados");
echo mysql_result($sql, 0, 0); ?>
</span> </span></div></td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<tr>
<td colspan="2">
<div align="center"><fieldset>
<legend>Mais enviou chamados <strong>(Geral) </strong> </legend>
<p>
<?php
#__________________________________NUMERO DE QUEM MAIS TEVE
CHAMADOS P/ SITUACAO__________________________________
for($i=1;$i<6;$i++)
{
176
$situa[1]='Concluidos';
$situa[2]='Em Espera';
$situa[3]='Cancelados';
177
$situa[4]='Em Andamento';
$situa[5]='Fechados';
if(!empty($result))
{
echo "<p align='left'><strong>$situa[$i]</strong> $result - $qnt</p>";
}else
{
echo "<p align='left'> <strong>$situa[$i]</strong> 0</p>";
}
}
?>
</p>
</fieldset>
</div>
</div></td>
</tr>
<tr>
<td colspan="2"> </td>
<td width="135"> </td>
<td width="135"> </td>
<td width="136"> </td>
</tr>
<tr>
</table>
<?php }?>
</body>
</html>
INDEX.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require_once("../libs/conn.php");
@session_start();
?>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
178
margin: 0;
padding: 0;
text-align: center;
color: #000000;
}
#site{
width: 900px;
height:600px;
background: #FFFFFF;
margin: 0 auto;
border: 2px solid #000000;
text-align: left;
}
#menu{
height:150px;
margin-top:5px;
margin-left:100px;
}
#mostraconteudo{
height:262px;
}
</style>
</head>
<body>
<div id="site">
<div id="topo">
<img src="../img/topo.png" width="900" height="150" /></div>
<div id="saudacao">
<?php include '../topo.php';?>
</div>
<div id="mostraconteudo">
179
</div>
</body>
</html>
MENU.PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Testando o menu drop-down</title>
<style type="text/css">
body { font: normal 62.5% verdana; }
ul.menubar{
margin: 0px;
padding: 0px;
background-color: #FFFFFF; /* IE6 Bug */
font-size: 100%;
}
ul.menubar .submenu{
margin: 0px;
padding: 0px;
list-style: none;
background-color: #FFFFFF;
border: 1px solid #ccc;
float:left;
}
ul.menubar ul.menu{
display: none;
position: absolute;
margin: 0px;
}
ul.menubar a{
padding: 5px;
display:block;
text-decoration: none;
color: #777;
padding: 5px;
}
ul.menu li{
position: relative;
list-style: none;
border: 0px;
}
ul.menu li a{
display: block;
text-decoration: none;
border: 1px solid #ccc;
border-bottom: 0px;
color: #777;
padding: 5px 10px 5px 5px;
}
ul.menu li sup{
font-weight:bold;
font-size:7px;
color: red;
}
ul.menu ul{
position: absolute;
display: none;
left: 149px; /* Set 1px less than menu width */
top: 0px;
}
</style>
<script type="text/javascript">
function horizontal() {
var navItems =
181
document.getElementById("menu_dropdown").getElementsByTagName("li");
</script>
<script type="text/javascript">
try{
xmlhttp = new XMLHttpRequest();
}
catch(ee){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E){
xmlhttp = false;
}
}
}
div_base = "";
valor = 0;
function abre(arquivo,metodo,div){
div_base = div;
valor++;
xmlhttp.open(metodo,arquivo+"?valor="+valor);
xmlhttp.onreadystatechange=conteudo
xmlhttp.send(null)
}
function conteudo() {
nova_div = div_base;
document.getElementById(nova_div).innerHTML="<div
style='top:50%;left:50%;position:absolute;'>carregando...</div>"
182
if (xmlhttp.readyState==4){
document.getElementById(nova_div).innerHTML=xmlhttp.responseText
}
}
</script>
</head>
<body onload="horizontal();">
</li>
<li class="submenu"><a href="#"> I N F O R M A C O E S</a>
</li>
</li>
<li class="submenu"><a href="#"> F I N A L I Z A R </a>
</li>
183
</ul>
</body>
</html>
TRATACADCLI.PHP
<?php
// Incluimos o arquivo de conexão
require_once("../libs/conn.php");
// Recuperamos os valores dos campos através do método POST utizando o TRIM
para retirar os espaços entre os caracteres
$cpf = trim($_POST["cpf"]);
$rg = trim($_POST["rg"]);
$nome = trim($_POST["nome"]);
$cnpj = trim($_POST["cnpj"]);
$rsocial = trim($_POST["rsocial"]);
$nfantasia = trim($_POST["nfantasia"]);
$endereco = trim($_POST["endereco"]);
$numero = trim($_POST["numero"]);
$complemento = trim($_POST["complemento"]);
$telefone1 = trim($_POST["telefone1"]);
$telefone2 = trim($_POST["telefone2"]);
$email = trim($_POST["email"]);
$cidade = trim($_POST["cidade"]);
$senha = trim($_POST["senha"]);
$categoria = 'cliente';
// Verifica as validações
if($cnpj == '' and $rsocial == '' and $nfantasia == ''){
$cnpj = 'nulo';
$rsocial = 'nulo';
$nfantasia = 'nulo';
}
if (empty($cpf)) {
echo "Digite o seu CPF";
}
elseif (empty($rg)) {
echo "Digite o seu RG";
184
elseif (empty($nome)) {
echo "Digite o seu Nome";
}
elseif (empty($cnpj)) {
echo "Digite o CNPJ da Empresa";
}
elseif (empty($rsocial)) {
echo "Digite a Razão Social da Empresa";
}
elseif (empty($nfantasia)) {
echo "Digite o nome fantasia de Empresa";
}
elseif (empty($endereco)) {
echo "Digite o endereco ";
}
elseif (empty($numero)) {
echo "Digite o Número da Residência";
}
elseif (empty($telefone1)) {
echo "Informe pelo menos um Número de Telefone";
}
elseif (empty($cidade)) {
echo "Selecione uma Cidade";
}
elseif (empty($senha)) {
echo "Digite uma Senha";
}
rg,email,categoria,senha,cidade) VALUES
('$nome','$cnpj','$rsocial','$nfantasia','$endereco','$numero','$complemento','$telefon
e1','$telefone2','$cpf','$rg','$email','$categoria','$senha','$cidade')")or die("Não foi
possível realizar o Cadastro no momento:");
}
?>
TRATACADCOP.PHP
<?php
// Incluimos o arquivo de conexão
require_once("../libs/conn.php");
// Recuperamos os valores dos campos através do método POST
$nserie = $_POST["nserie"];
$modelo = $_POST["modelo"];
$numerador = $_POST["numerador"];
$telefone1 = trim($_POST["telefone1"]);
$telefone2 = trim($_POST["telefone2"]);
$dnasc = trim($_POST['dnasc']);
$cpf = trim($_POST["cpf"]);
$rg = trim($_POST["rg"]);
$email = trim($_POST["email"]);
$categoria = trim($_POST["categoria"]);
$senha = trim($_POST["senha"]);
elseif (empty($endereco)) {
echo "Digite o Endereço";
}
elseif (empty($numero)) {
echo "Digite o Número de sua Residencia";
}
elseif (empty($telefone1)) {
echo "Informe pelo menos um Telefone";
}
elseif (empty($dnasc)) {
echo "Informe a Data do seu Nascimento";
}
elseif (empty($cpf)) {
echo "Digite seu CPF";
}
elseif (empty($rg)) {
echo "Digite seu RG";
}
elseif (empty($email)) {
echo "Digite seu Email";
}
elseif (empty($senha)) {
echo "Digite uma Senha";
}
elseif (empty($endereco)) {
echo "Digite o Endereço";
}
188
elseif (empty($numero)) {
echo "Digite o Número de sua Residencia";
}
elseif (empty($telefone1)) {
echo "Informe pelo menos um Telefone";
}
elseif (empty($dnasc)) {
echo "Informe a Data do seu Nascimento";
}
elseif (empty($cpf)) {
echo "Digite seu CPF";
}
elseif (empty($rg)) {
echo "Digite seu RG";
}
elseif (empty($email)) {
echo "Digite seu Email";
}
elseif (empty($senha)) {
echo "Digite uma Senha";
}
SISCHA.BD
-- phpMyAdmin SQL Dump
-- version 3.2.0.1
-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tempo de Geração: Nov 19, 2010 as 04:06 AM
-- Versão do Servidor: 5.1.36
-- Versão do PHP: 5.3.0
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-- --------------------------------------------------------
-- --------------------------------------------------------
191
-- --------------------------------------------------------
INSERT INTO `usuarios` (`id`, `senha`, `cpf`, `rg`, `cnpj`, `rsocial`, `nfantasia`,
`nome`, `endereco`, `numero`, `complemento`, `telefone1`, `telefone2`, `dnasc`,
`email`, `cidade`, `categoria`) VALUES
(1, '123', '00719076021', '6082745313', '', '', '', 'Diego', 'Marechal Floriano', '4531',
'fundos', '5584111842', '5599885674', '20/06/1986', 'diego@barbat.com.br', '',
'tecnico'),
(2, 'barbat', '45645645456', '4949465465', '', '', '', 'luana samanta flores barbat',
'Marechal Floriano', '1111', 'nao tem', '444444444', '555555555', '27/12/1989',
'luana@barbat.com.br', '', 'secretaria'),
(14, 'advince', '16515616978', '1615498489', '', '', '', 'Candido Advince', 'Cabo luiz
Queveo', '4587', '', '5588896547', '5534125889', '22/12/1970',
'candido@candido.com.br', '', 'vendedor'),
(15, 'torres', '00051515157', '6665257744', 'nulo', 'nulo', 'nulo', 'Juliana Torres de
Rosso', 'Vasco Alves', '3346', 'apto 201', '5534122962', '5596274861', '',
'juliana@juliana.com.br', 'Uruguaiana', 'cliente');
-- --------------------------------------------------------