Location: PHPKode > scripts > Interfaces > interfaces/classes/class.interfaces.php
<?php

// +-----------------------------------------------------------------+
// | 	 CLASSE EM PHP4 PARA GERACAO DE INTERFACES EM HTML 	 	     |
// +-----------------------------------------------------------------+
// | CopyLeft (L) 2006-2007 Roberto Bertolini Salgado                |
// +-----------------------------------------------------------------+
// | http://www.opensource.org/licenses/bsd-license.php		         |
// | Site: http://www.via6.com/RobertoSalgado                        |
// | E-mail: hide@address.com                                   |
// +-----------------------------------------------------------------+
// | Data do Inicio: 		28 DE MARÇO DE 2006 			         |
// | Data da Modificacao:   22 DE AGOSTO DE 2007 			         |
// | Versão: 0.2  		                                             |
// +-----------------------------------------------------------------+

require_once ("class.db.php");

class Interfaces extends DB {

	var $URL;

	// Banco

	var $Tbl;
	var $Cat;
	var $Col1;
	var $Col2;
	var $Link;
	var $LinkEditar;
	var $CodNome;
	var $NomeCat;
	var $NomeCol1;
	var $NomeCol2;

	// Propriedades do Registro

	var $Limite;
	var $CelAlt;
	var $CelCor;
	var $CelCorTit;
	var $CelCorAtivo;
	var $DirImg;
	var $CorLido;

	// Propriedades das Colunas do Registro
	
	var $ColBusca;
	var $ColTopo;
	var $ColProp;
	var $ColAlig;
	var $ColCampo;
	var $Colunas;
	var $ArraySelect;


	// Janela

	var $Janela_Descricao_Nome;
	var $Janela_Descricao_Altura;
	var $Janela_Descricao_Largura;
	var $Janela_Desativar_Nome;
	var $Janela_Desativar_Altura;
	var $Janela_Desativar_Largura;
	var $Janela_Alterar_Nome;
	var $Janela_Alterar_Altura;
	var $Janela_Alterar_Largura;
	
	/**
	 *  - Função Janela_Titulo
	 *  - Descrição Função para criar o topo do HTML
	 *    e adicionar o Titulo da página,
	 *    arquivos de JavaScript e $Arquivos CSS
	 * 
	 *  - Exemplo:
	 *    Janela_Titulo("Titulo",array("arq1.js","arq2.js"),array("arq1.css","arq2.css"));
	 */
	function Janela_Titulo($Titulo, $ArquivoJS, $ArquivoCSS) {

		echo "\n\n<!-- Cabeçalho HTML -->\n\n" .
		"<html>\n" .
		"<head>\t\n" .
		"\t<title>" . $Titulo . "</title>\n" .
		"\t<META HTTP-EQUIV=\"Content-type\" content=\"text/html; charset=iso-8859-1\">\n" .
		"\t<META HTTP-EQUIV=\"Content-Languag\" content=\"pt-br\">\n" .
		"\t<META HTTP-EQUIV=\"refresh\" content=\"100\">\n" .
		"\t<META HTTP-EQUIV=\"Cache-Control\" content=\"no-cache, no-store\">\n" .
		"\t<META HTTP-EQUIV=\"Pragma\" content=\"no-cache, no-store\">\n" .
		"\t<META HTTP-EQUIV=\"expires\" content=\"00:00:01\">\n" .
		"\t<link rel=\"SHORTCUT ICON\" href=\"../imagens/favicon.ico\">\n";

		$TotalArquivoCSS = count($ArquivoCSS);

		for ($Indice = 0; $Indice < $TotalArquivoCSS; $Indice++) {

			echo "\t<link rel=\"stylesheet\" href=\"../classes/css/" . $ArquivoCSS[$Indice] . "\" type=\"text/css\">\n";

		}

		$TotalArquivoJS = count($ArquivoJS);

		for ($Indice = 0; $Indice < $TotalArquivoJS; $Indice++) {

			echo "\t<script language=\"JavaScript\" src=\"../classes/js/" . $ArquivoJS[$Indice] . "\"></script>\n";

		}

		echo "</head>\n";

	}

	function Body($Bg, $BgColor, $MargemTopo, $MargemEsq, $MargemDir, $MargemFundo) {

		//"<body oncontextmenu=\"return false\">\n\n";

		$String = "\n<!-- Corpo HTML -->\n\n" .
		"<body " .
		"background=\"" . $Bg . "\" " .
		"bgcolor=\"" . $BgColor . "\" " .
		"topmargin=\"" . $MargemTopo . "\" " .
		"leftmargin=\"" . $MargemEsq . "\" " .
		"rightmargin=\"" . $MargemDir . "\" " .
		"bottommargin=\"" . $MargemFundo . "\">\n";

		echo $String;

	}

	function Topo_Aplicacao($Valor) {

		$String = "\n<!-- Topo Janela -->\n\n" .
		"\t<table width=\"100%\" " .
		"height=\"80\" " .
		"border=\"0\" " .
		"cellpadding=\"0\" " .
		"cellspacing=\"0\" background=\"" . $this->DirImg . $Valor["bg"] . "\">\n" .
		"\t<tr>\n" .
		"\t<td bgcolor=\"" . $Valor["bgcolor"] . "\" background=\"" . $this->DirImg . $Valor["bg"] . "\">" .
		"<img src=\"" . $this->DirImg . $Valor["logo"] . "\">" .
		"</td>\n" .
			//"\t<td width=\"76%\" bgcolor=\"".$Valor["bgcolor"]."\">&nbsp;</td>\n" .
	"\t</tr>\n" .
		"\t</table>\n";

		echo $String;
	}

	function Rodape() {

	}

	function Janela_Fim($String) {

		echo $String .

		"\n<!-- HTML Fim-->\n\n" .
		"</body>\n" .
		"</html>\n";

	}

	// REGISTROS

	function Registros_Opcoes($CodNome, $NomeCat) {

		$this->CodNome = $CodNome;
		$this->NomeCat = $NomeCat;

	}

	function Registro_Link($valor) {

		if ($valor == "") {
			$this->Link = "#";
		} else {
			$this->Link = $valor;
		}
	}

	function Registro_Link_Editar($valor) {

		if ($valor == "") {
			$this->LinkEditar = "#";
		} else {
			$this->LinkEditar = $valor;
		}
	}

	function RegistrosDescricaoOpcoes($Altura, $Largura, $Nome) {

		$this->Janela_Descricao_Altura = $Altura;
		$this->Janela_Descricao_Largura = $Largura;
		$this->Janela_Descricao_Nome = $Nome;
	}

	function RegistrosAlterarOpcoes($Altura, $Largura, $Nome) {

		$this->Janela_Alterar_Altura = $Altura;
		$this->Janela_Alterar_Largura = $Largura;
		$this->Janela_Alterar_Nome = $Nome;

	}

	function Registros_Coluna_Alterar($Opcao, $Tipo, $ChavePrimaria) {

		if ($Opcao == "S") {

			switch ($Tipo) {

				case "Topo" :

					echo "\t<td align=\"center\" width=\"10%\" class=\"TextoNegrito\"> [ Visualizar ] </td>\n";

					break;

				case "Registro" :

					echo "\t<td align=\"center\" width=\"10%\">" .
					"<a href=\"#\" onClick=\"window.open('" . $this->LinkEditar . "?cod=" . $ChavePrimaria . "&Chave=" . md5(microtime(1)) . "','Editar','resizable=no,scrollbars=yes,width=" . $this->Janela_Alterar_Largura . ",height=" . $this->Janela_Alterar_Altura . "')\">" .
					"<img src=\"" . $this->DirImg . "editar.png\"\" border=\"0\">" .
					"</a>" .
					"</td>\n";
					break;

			}

		}

	}

	function Registros_Colunas_Topo() {

		$this->Colunas = count($this->ColProp);

		echo "\n<!-- Topo Registros -->\n\n" .
		"\t<table width=\"100%\">\n" .
		"\t<form action=\"?acao=desativar\" method=\"POST\" name=\"Desativar\" target=\"_blank\">" .
		"\t<tr bgcolor=\"#C7CDD7\" height=\"" . $this->CelAlt . "\">\n";

		for ($Indice = 0; $Indice < $this->Colunas; $Indice++) {

			echo "\t<td align=\"" . $this->ColAlig[$Indice] . "\" width=\"" . $this->ColProp[$Indice] . "\" class=\"TextoNegrito\">";

			if ($this->ColAlig[$Indice] == "left") {
				echo "&nbsp;";
			}

			echo "[ " . $this->ColTopo[$Indice] . " ]</td>\n";

		}

		$this->Registros_Coluna_Alterar("S", "Topo", "");

		echo "\t<td align=\"center\" width=\"10%\" class=\"TextoNegrito\"><b>[ Excluir ]</b></td>\n" .
		"\t</tr>\n" .
		"\n<!-- Registros Dados -->\n";

	}

	function CorCelulaLido($Boleano) {

		if (strtoupper($Boleano) == "S") {
			$this->CorLido = "#FFFF00";
		} else {
			$this->CorLido = "#EAEAEA";
		}

	}

	function RegistrosSelect($ArraySelect) {

		$String = "<select name=\"coluna\">";

		foreach ($ArraySelect as $OptionNome => $OptionValor) {

			$String .= "<option value=\"" . $OptionValor . "\">" . strtoupper($ArraySelect[$OptionNome]) . "</option>";

		}

		$String .= "</select>";

		return $String;

	}

	function Registros($Bloco, $Palavra) {

		$Bloco  = $this->vString($Bloco);
		$Palvra = strtoupper($this->vString($Palavra));

		if ($Bloco == "") {
			$Bloco = "0";
		}

		if (empty ($Palavra)) {

			$SQL = "SELECT " . implode(", ", $this->ColCampo) .
			" FROM " . $this->Tbl . " WHERE ativo='s'" .
			" ORDER BY " . $this->CodNome . " DESC" .
			" LIMIT " . $this->Limite . " OFFSET " . $Bloco;
			
			$this->RecordSet("SELECT count(*) AS TotalRegistros FROM " . $this->Tbl . " WHERE ativo = 's' ");
			$Total = $this->Obj->TotalRegistros;

		} else {

			$SQL = "SELECT ".implode(", ", $this->ColCampo)." FROM " . $this->Tbl .
			" WHERE " . $this->ColBusca . " LIKE '%" . $Palavra . "%' " .
			" AND ativo = 's' " .
			" ORDER BY " . $this->CodNome . " DESC ";
			
			$this->RecordSet("SELECT count(*) AS TotalRegistrosBusca FROM " . $this->Tbl . " WHERE ".$this->ColBusca." LIKE '%" . $Palavra . "%'");
			$Total = $this->Obj->TotalRegistrosBusca;

		}

		$Query = $this->Query($SQL) OR die(mysql_error());

		
		if ($Total < $this->Limite) {

			$Menu = "";

		} elseif ($Bloco === "" or $Bloco === "0") {

			$Menu = "\t\t<img src=\"" . $this->DirImg . "setapri.png\" border=\"0\">\n " .
			"<img src=\"" . $this->DirImg . "setaesq.png\" border=\"0\">\n " .
			"<a href=\"?acao=registros&bloco=" . ($Bloco + $this->Limite) . "&Chave=" . md5(microtime(1)) . "\">" .
			"<img src=\"" . $this->DirImg . "setadir.png\" border=\"0\"></a> " .
			"<a href=\"?acao=registros&bloco=" . ($Total -1) . "&Chave=" . md5(microtime(1)) . "\">" .
			"<img src=\"" . $this->DirImg . "setafim.png\" border=\"0\"></a>";

		} elseif ($Total > ($Bloco + $this->Limite)) {

			$Menu = "<a href=\"?acao=registros&bloco=0\">" .
			"<img src=\"" . $this->DirImg . "setapri.png\" border=\"0\"></a> " .
			"<a href=\"?acao=registros&bloco=" . ($Bloco - $this->Limite) . "&Chave=" . md5(microtime(1)) . "\">" .
			"<img src=\"" . $this->DirImg . "setaesq.png\" border=\"0\"> " .
			"<a href=\"?acao=registros&bloco=" . ($Bloco + $this->Limite) . "&Chave=" . md5(microtime(1)) . "\">" .
			"<img src=\"" . $this->DirImg . "setadir.png\" border=\"0\"></a>  " .
			"<a href=\"?acao=registros&bloco=" . ($Total -1) . "\">" .
			"<img src=\"" . $this->DirImg . "setafim.png\" border=\"0\"></a>";

		} elseif ($Total > $Bloco) {

			$Menu = "<a href=\"?acao=registros&bloco=0\">" .
			"<img src=\"" . $this->DirImg . "setapri.png\" border=\"0\"></a>  " .
			"<a href=\"?acao=registros&bloco=" . ($Bloco - $this->Limite) . "&Chave=" . md5(microtime(1)) . "\">" .
			"<img src=\"" . $this->DirImg . "setaesq.png\" border=\"0\"></a>  " .
			"<img src=\"" . $this->DirImg . "setadir.png\" border=\"0\"> " .
			"<img src=\"" . $this->DirImg . "setafim.png\" border=\"0\">";

		}

		$TR = "bgcolor=\"" . $this->CelCor . "\" height=\"" . $this->CelAlt . "\" " .
		"onMouseOver=\"bgColor='" . $this->CelCorAtivo . "'\" " .
		"onMouseOut=\"bgColor='" . $this->CelCor . "'\" " .
		"onMouseDown=\"bgColor='" . $this->CelCorAtivo . "'\" ";

		echo "\n<!-- Registros Busca + Paginacao -->\n\n" .
		"\n\t<table width=\"100%\" height=\"30\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n" .
		"\t<tr>\n" .
		"\t<td height=\"" . $this->CelAlt . "\" colspan=\"4\" background=\"" . $this->DirImg . "bg.jpg\" bgcolor=\"#A7A6AA\" class=\"TextoBrancoNegrito\">\n" .
		"\n\n<!-- Barra -->\n\n" .
		"\t\t<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\">\n" .
		"\t\t<form name=\"Busca\" action=\"?acao=buscar&Chave=" . md5(microtime(1)) . "\" method=\"POST\" onSubmit=\"return validateForm(this);\">\n" .
		"\t\t<tr class=\"TextoBrancoNegrito\">\n" .
		"\t\t<td width=\"10%\" align=\"center\">" . $Menu . "</td>\n" .
		"\t\t<td width=\"20%\" align=\"left\">&nbsp;&nbsp;[ " . strtoupper($this->NomeCat) . " ]</td>\n" .
		"\t\t<td width=\"20%\" align=\"right\">&nbsp;&nbsp; Procurar em " . $this->NomeCat . "&nbsp;&raquo;&raquo;&raquo; </td>\n" .
		"\t\t<td width=\"30%\" align=\"center\">" .
		"\t\t" . $this->RegistrosSelect($this->ArraySelect) .
		"\t\t<input type=\"text\" name=\"palavra\" size=\"30\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\">\n " .
		"\t\t</td>\n" .
		"\t\t<td width=\"3%\" align=\"left\">" .
		"\t\t<input type=\"image\" src=\"" . $this->DirImg . "bt_pesquisa.gif\" border=\"0\">\n" .
		"\t\t</td>\n" .
		"\t\t</tr>\n" .
		"\t\t</form>\n" .
		"\t\t</table>\n" .
		"\t</table>\n";

		if (@ mysql_num_rows($Query) >= 1) {

			if (!empty($Palavra)) {
				
				$this->Tabela("25","100%","0","","center","2","2","");
				$this->Campo_Atencao("Foram encontradas ".$Total." ocorrencia(s) na busca com (" . strtoupper($Palavra).") em [".strtoupper($this->ColBusca)."]");
				$this->Tabela_Fecha();
				
			}

			$this->Registros_Colunas_Topo();

			while ($Array = $this->RetornaArray($Query)) {

				$this->CorCelulaLido($Array["lido"]);

				echo "\n\t<tr bgcolor=\"" . $this->CorLido . "\" " . $TR . ">\n";

				for ($Indice = 0; $Indice < $this->Colunas; $Indice++) {

					echo "\t<td align=\"" . $this->ColAlig[$Indice] . "\" width=\"" . $this->ColProp[$Indice] . "\" class=\"TextoArial\">";

					if ($this->ColAlig[$Indice] == "left") {
						echo "&nbsp;";
					}

					echo $Array[$this->ColCampo[$Indice]] . "</td>\n";

				}

				$this->Registros_Coluna_Alterar("S", "Registro", $Array[$this->CodNome]);


				echo "\t<td align=\"center\" width=\"10%\">" .
				"<input type=\"checkbox\">" .
				"</td>\n" .
				"\t</tr>\n";

			}

			echo "\n\t<tr bgcolor=\"#EAEAEA\">\n" .
			"\t<td colspan=\"" . ($this->Colunas + 1) . "\" class=\"TextoArial\"></td>\n" .
			"\t<td width=\"10%\" align=\"center\"><input type=\"submit\" value=\"Apagar\" ></td>\n";

		} else {

			echo "\n<!-- resultado -->";
			$this->Tabela("");
			$this->Campo_Atencao("Não foi encontrada nenhuma referencia com " . $Palavra);
			$this->Campo_Voltar();
			$this->Tabela_Fecha();
		}

		echo "\t</tr>\n" .
		"\t</form>\n" .
		"\t</table>\n";

	}

	// FORMULARIO

	function Topo_Form($texto) {

		$String = "<!-- Topo Form --> \n\n" .
		"\t\n<table width=\"100%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"0\">" .
		"\t\n<tr>" .
		"\t\n<td height=\"25\" background=\"" . $this->DirImg . "bg.jpg\" bgcolor=\"#A7A6AA\" class=\"TextoBrancoNegrito\">&nbsp;&nbsp; [ $texto ]</td>" .
		"\t\n</tr>" .
		"\t\n<tr>" .
		"\t\n<td height=\"19\" background=\"" . $this->DirImg . "menu_navegacao_bg.gif\" bgcolor=\"#EBE9ED\" class=\"TextoArial\"></td>" .
		"\t\n</tr>" .
		"\t\n</table>\n\n";

		echo $String;

	}

	function Form($nome, $acao, $metodo, $enctype) {

		/* 	Enctype ->
		*	appliCation/x-www-form-urlencoded
		*	multipart/form-data
		*	text/plain
		*/

		$String = "\t<form name=\"" . $nome . "\" action=\"" . $acao . "&Chave=" . md5(microtime(1)) . "\" method=\"" . $metodo . "\" enctype=\"" . $enctype . "\" onSubmit=\"return ValidaFormulario(this);\">\n";

		echo $String;

	}

	function Form_Fecha($valor_botao) {

		$String = "\t<tr>\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"right\" class=\"Texto\">&nbsp;<input type=\"submit\" value=\"" . $valor_botao . "\">&nbsp;<input type=\"submit\" value=\"Fechar\" OnClick=\"window.close()\"></td>\n" .
		"\t</tr>\n" .
		"\t</form>\n";

		echo $String;

	}

	function Campo_Voltar() {

		$String = "\t<form>\n\t<tr>\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"right\" class=\"Texto\">&nbsp;<input type=\"submit\" value=\"Voltar\"></td>\n" .
		"\t</tr>\n" .
		"\t</form>\n";

		echo $String;

	}

	function Form_Fecha_3_Col($valor_botao) {

		$String = "\t<tr>\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"right\" class=\"Texto\">&nbsp;<input type=\"submit\" value=\"" . $valor_botao . "\"></td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t</tr>\n" .
		"\t</form>\n";

		echo $String;

	}

	function Form_Fecha_5_Col($valor_botao) {

		$String = "\t<tr>\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"right\" class=\"Texto\">&nbsp;<input type=\"submit\" value=\"" . $valor_botao . "\"></td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\" bgcolor=\"" . $this->CelCor . "\" align=\"left\" class=\"Texto\"></td>\n" .
		"\t</tr>\n" .
		"\t</form>\n";

		echo $String;

	}

	// TABELA DA INTERFACE

	function Tabela($altura = "", $largura = "100%", $borda = "0", $bordercolor = "", $alinhamento = "center", $cellpadding = "2", $cellspacing = "0", $classe = "") {

		$comentario = "\n<!-- INTERFACE -->\n\n";

		$String = "\t<table " .
		"class=\"" . $classe . "\" " .
		"height=\"" . $altura . "\" " .
		"width=\"" . $largura . "\" " .
		"border=\"" . $borda . "\" " .
		"bordercolor=\"" . $bordercolor . "\" " .
		"align=\"" . $alinhamento . "\" " .
		"cellpadding=\"" . $cellpadding . "\" " .
		"cellspacing=\"" . $cellspacing . "\">\n";

		echo $comentario . $String;

	}

	function Tabela_Fecha() {

		$String = "\t</table>\n\n";

		echo $String;

	}

	// TITULO DA TABELA

	function Titulo($titulo) {

		$String = "\t<tr height=\"25\">\n\t<td bgcolor=\"" . $this->CelCorTit . "\" colspan=\"3\" class=\"TextoBrancoNegrito\">&nbsp; &raquo; " . $titulo . "</td>\n\t</tr>\n";
		echo $String;
	}

	function Titulo_Opcoes($titulo, $cod) {

		$String = "\t<tr height=\"25\">\n\t" .
		"<td colspan=\"2\" class=\"TextoBrancoNegrito\">" .
		"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" .
		"<tr>" .
		"<td height=\"25\" class=\"TextoBrancoNegrito\" bgcolor=\"" . $this->CelCorTit . "\">&nbsp;" . $titulo . "</td>" .
		"<td width=\"12%\" height=\"" . $this->CelAlt . "\" align=\"center\" bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\"><a href=\"javascript:history.go(-1)\">Voltar</a></td>" .
		"<td width=\"12%\" height=\"" . $this->CelAlt . "\" align=\"center\" bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\"><a href=\"?acao=imprimir&cod=" . $cod . "\" target=\"_blank\">Imprimir</a></td>" .
		"<td width=\"12%\" height=\"" . $this->CelAlt . "\" align=\"center\" bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\"><a href=\"?acao=editar&cod=" . $cod . "\">Editar</a></td>" .
		"<td width=\"12%\" height=\"" . $this->CelAlt . "\" align=\"center\" bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\"><a href=\"?acao=desativar&cod=" . $cod . "\">Desativar</a></td>" .
		"</tr>" .
		"</table>" .
		"</td>\n\t" .
		"</tr>\n";

		echo $String;
	}

	// TIPO DE CAMPOS

	function Campo_Oculto($nome, $valor) {

		$String = "\t<input type=\"hidden\" name=\"" . $nome . "\" value=\"" . $valor . "\">\n";

		echo $String;

	}

	function Campo_Texto($nome, $campo, $tamanho, $limite, $valor, $var) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ":</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;<input type=\"text\" name=\"" . $campo . "\" size=\"" . $tamanho . "\" maxlength=\"" . $limite . "\" value=\"" . $valor . "\" " . $var . " onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Anexo($nome, $campo) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;<input name=\"" . $campo . "\" size=\"50\" type=\"file\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_CheckBox($Cod, $Nome, $Valor, $Checked) {

		if (!empty ($Checked)) {
			$Checked = "checked=\"CHECKED\" ";
		} else {
			$Checked = "";
		}

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;<input $Checked type=\"checkbox\" name=\"" . $Cod . "\" value=\"" . $Valor . "\"></td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $Nome . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Nota($nomecod, $nome, $codigo, $notame, $notaredacao) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"20%\" align=\"center\"><input name=\"" . $nomecod . "[]\" value=\"" . $codigo . "\" type=\"hidden\"><input name=\"PontosME[]\" type=\"text\" size=\"2\" maxlength=\"2\" value=\"" . $notame . "\"></td>\n" .
		"\t<td width=\"20%\" align=\"center\"><input name=\"PontosRedacao[]\" type=\"text\" size=\"2\" maxlength=\"2\" value=\"" . $notaredacao . "\"></td>\n" .
		"</tr>";

		echo $String;

	}

	function Campo_Descricao_Topo_Col_4($valor, $valor1, $valor2, $valor3, $valor4) {

		$String = "\t<tr bgcolor=\"" . $this->CelCorTit . "\" >\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor2 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor3 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor4 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Topo_Col_6($valor, $valor1, $valor2, $valor3, $valor4, $valor5) {

		$String = "\t<tr bgcolor=\"" . $this->CelCorTit . "\" >\n" .
		"\t<td width=\"50%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor2 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor3 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor4 . "</td>\n" .
		"\t<td width=\10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor5 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Nota_5($matricula, $nomecod, $nome, $codigo, $nota1bim, $nota2bim, $examefinal, $frequencia) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\" align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"10%\" align=\"center\">" .
		"<input name=\"matricula[]\" value=\"" . $matricula . "\" type=\"hidden\">" .
		"<input name=\"" . $nomecod . "[]\" value=\"" . $codigo . "\" type=\"hidden\">" .
		"<input name=\"nota1bim[]\" type=\"text\" size=\"3\" maxlength=\"4\" value=\"" . $nota1bim . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t<td width=\"10%\" align=\"center\"><input name=\"nota2bim[]\"   type=\"text\" size=\"3\" maxlength=\"4\" value=\"" . $nota2bim . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t<td width=\"10%\" align=\"center\"><input name=\"examefinal[]\" type=\"text\" size=\"3\" maxlength=\"4\" value=\"" . $examefinal . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t<td width=\"10%\" align=\"center\"><input name=\"frequencia[]\" type=\"text\" size=\"3\" maxlength=\"3\" value=\"" . $frequencia . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_AreaTexto($nome, $campo, $colunas, $linhas, $valor) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" valign=\"top\" class=\"Texto\">&nbsp;" . $nome . ": </td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;<textarea name=\"$campo\" cols=\"$colunas\" rows=\"$linhas\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\">$valor</textarea></td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_DB_Select($nome, $campo, $valor, $sql, $opcao_valor, $opcao) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\" bgcolor=\"#EAEAEA\" height=\"22\" onMouseOver=\"bgColor='#C7CDD7'\" onMouseOut=\"bgColor='#EDEDED'\" onMouseDown=\"bgColor='#EDEDED'\" >\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ":</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\n\n\t\t<select name=\"" . $campo . "\">\n" .
		"\t\t<option value=\"0\">SELECIONE</option>\n";

		$Query = $this->Query($sql);

		while ($Obj = mysql_fetch_object($Query)) {

			if ($Obj-> $opcao_valor == $valor) {

				echo "\t\t<option value=\"" . $Obj-> $opcao_valor . "\" selected>" . $Obj-> $opcao . "</option>\n";

			} else {

				echo "\t\t<option value=\"" . $Obj-> $opcao_valor . "\">" . $Obj-> $opcao . "</option>\n";

			}

		}

		echo "\t\t</select>\n\n\t</td>\n\t</tr>\n";

	}

	function Campo_Select($nome, $valores, $campo) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ":</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\n\n\t\t<select name=\"" . $campo . "\">\n" .
		"\t\t<option value=\"0\">SELECIONE</option>\n";

		foreach ($valores as $var => $cmp) {

			echo "<option value=\"" . $cmp . "\">" . $var . "</option>";

		}

		echo "</select>\n";

	}

	function Campo_Data($nome, $nome_campo, $valor, $nome_form) {

		$_dia = substr($valor, 8, 10);
		$_mes = substr($valor, 5, 2);
		$_ano = substr($valor, 0, 4);

		$valor = array (
			$_dia,
			$_mes,
			$_ano
		);

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ":</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\t\t<input type=\"text\" name=\"" . $nome_campo . "_dia\" size=\"2\" maxlength=\"2\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\" onKeyUp=\"campo_data(this.name)\" value=\"" . $_dia . "\">  / " .
		"\t\t<input type=\"text\" name=\"" . $nome_campo . "_mes\" size=\"2\" maxlength=\"2\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\" onKeyUp=\"campo_data(this.name)\" value=\"" . $_mes . "\">  / " .
		"\t\t<input type=\"text\" name=\"" . $nome_campo . "_ano\" size=\"4\" maxlength=\"4\"/ value=\"" . $_ano . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\" onKeyUp=\"campo_data(this.name)\">" .
		"</td>\n" .
		"\t</tr>\n";
	}

	function DataDMA($valor) {

		$_dia = substr($valor, 8, 10);
		$_mes = substr($valor, 5, 2);
		$_ano = substr($valor, 0, 4);
		$Data = $_dia . "/" . $_mes . "/" . $_ano;

		return $Data;

	}

	function Campo_CPF($nome, $valor) {

		$cpf1 = substr($valor, 0, 8);
		$cpf2 = substr($valor, 9, 10);
		$valor = array (
			$cpf1,
			$cpf2
		);

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"<input type=\"text\" name=\"cpf1\" size=\"11\" maxlength=\"9\" value=\"" . $valor["0"] . "\"> - " .
		"<input type=\"text\" name=\"cpf2\" size=\"2\" maxlength=\"2\" value=\"" . $valor["1"] . "\">" .
		"</td>\n" .
		"\t</tr>\n";

		echo $String;
	}

	function Campo_CEP($valor) {

		$cep1 = substr($valor, 0, 5);
		$cep2 = substr($valor, 5, 7);
		$valor = array (
			$cep1,
			$cep2
		);

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\" align=\"left\" class=\"Texto\">&nbsp;CEP</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\" align=\"left\" class=\"Texto\">&nbsp;" .
		"<input type=\"text\" name=\"cep1\" size=\"5\" maxlength=\"5\" value=\"" . $valor["0"] . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\" onKeyUp=\"campo_cep(this.name)\"> - " .
		"<input type=\"text\" name=\"cep2\" size=\"3\" maxlength=\"3\" value=\"" . $valor["1"] . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\" onKeyUp=\"campo_cep(this.name)\">" .
		"</td>\n" .
		"\t</tr>\n";

		echo $String;
	}

	function Campo_Senha($nome, $campo, $tamanho, $limite, $valor) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ":</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;<input type=\"password\" name=\"" . $campo . "\" size=\"" . $tamanho . "\" maxlength=\"" . $limite . "\" value=\"" . $valor . "\" onFocus=\"this.style.backgroundColor = '#EAEAEA'\" onBlur=\"this.style.backgroundColor = '#FFFFFF'\"></td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Nivel($valor) {

		echo "\t<tr bgcolor=\"" .

		$this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;Nivel:</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\n\t\t<select name=\"nivel\">\n";

		switch ($valor) {

			case "GRADUACAO" :

				echo "\t\t<option value=\"GRADUACAO\" selected>GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"POS-GRADUACAO\">PÓS-GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"MESTRADO\">MESTRADO</option>\n" .
				"\t\t<option value=\"DOUTORADO\">DOUTORADO</option>\n";

				break;

			case "POS-GRADUACAO" :

				echo "\t\t<option value=\"GRADUACAO\">GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"POS-GRADUACAO\" selected>PÓS-GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"MESTRADO\">MESTRADO</option>\n" .
				"\t\t<option value=\"DOUTORADO\">DOUTORADO</option>\n";

				break;

			case "MESTRADO" :

				echo "\t\t<option value=\"GRADUACAO\">GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"POS-GRADUACAO\" >PÓS-GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"MESTRADO\" selected>MESTRADO</option>\n" .
				"\t\t<option value=\"DOUTORADO\">DOUTORADO</option>\n";

				break;

			case "DOUTORADO" :

				echo "\t\t<option value=\"GRADUACAO\">GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"POS-GRADUACAO\" >PÓS-GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"MESTRADO\">MESTRADO</option>\n" .
				"\t\t<option value=\"DOUTORADO\" selected>DOUTORADO</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"GRADUACAO\" selected>GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"POS-GRADUACAO\">PÓS-GRADUAÇÃO</option>\n" .
				"\t\t<option value=\"MESTRADO\">MESTRADO</option>\n" .
				"\t\t<option value=\"DOUTORADO\">DOUTORADO</option>\n";

				break;

		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

	function Campo_Sexo($valor) {

		echo "\t<tr bgcolor=\"" .

		$this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;Sexo:</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\n\n\t\t<select name=\"sexo\">\n";

		switch ($valor) {

			case "MASCULINO" :

				echo "\t\t<option value=\"MASCULINO\" selected>MASCULINO</option>\n" .
				"\t\t<option value=\"FEMININO\">FEMININO</option>\n";

				break;

			case "FEMININO" :

				echo "\t\t<option value=\"MASCULINO\">MASCULINO</option>\n" .
				"\t\t<option value=\"FEMININO\" selected>FEMININO</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"MASCULINO\">MASCULINO</option>\n" .
				"\t\t<option value=\"FEMININO\">FEMININO</option>\n";
				break;

		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

	function Campo_Carga_Horaria($texto, $valor) {

		echo "\t<tr bgcolor=\"" .

		$this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $texto . "</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\n\t\t<select name=\"carga_horaria\">\n";

		switch ($valor) {

			case "20" :

				echo "\t\t<option value=\"20\" SELECTED>20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "30" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\" SELECTED>30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "40" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\" SELECTED>40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "50" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\" SELECTED>50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "60" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\" SELECTED>60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "70" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\" SELECTED>70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

			case "80" :

				echo "\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\" SELECTED>80</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"0\" SELECTED>SELECIONE</option>\n" .
				"\t\t<option value=\"20\">20</option>\n" .
				"\t\t<option value=\"30\">30</option>\n" .
				"\t\t<option value=\"40\">40</option>\n" .
				"\t\t<option value=\"50\">50</option>\n" .
				"\t\t<option value=\"60\">60</option>\n" .
				"\t\t<option value=\"70\">70</option>\n" .
				"\t\t<option value=\"80\">80</option>\n";

				break;

		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

	function Campo_Estado_Civil($valor) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;Estado Civil:</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\t\t<select name=\"estado_civil\">\n";

		switch ($valor) {

			case "CASADO(A)" :

				echo "\t\t<option value=\"CASADO(A)\" selected>Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\">Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\">Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\">Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\">Outros(a)</option>\n";

				break;

			case "SOLTEIRO(A)" :

				echo "\t\t<option value=\"CASADO(A)\">Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\" selected>Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\">Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\">Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\">Outros(a)</option>\n";

				break;

			case "VIUVO(A)" :

				echo "\t\t<option value=\"CASADO(A)\">Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\">Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\" selected>Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\">Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\">Outros(a)</option>\n";

				break;

			case "DIVORCIADO(A)" :

				echo "\t\t<option value=\"CASADO(A)\">Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\">Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\">Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\" selected>Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\">Outros</option>\n";

				break;

			case "OUTROS" :

				echo "\t\t<option value=\"CASADO(A)\">Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\">Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\">Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\">Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\" selected>Outros</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"CASADO(A)\">Casado(a)</option>\n" .
				"\t\t<option value=\"SOLTEIRO(A)\">Solteiro(a)</option>\n" .
				"\t\t<option value=\"VIUVO(A)\">Vi&uacute;vo(a)</option>\n" .
				"\t\t<option value=\"DIVORCIADO(A)\">Divorciado(a)</option>\n" .
				"\t\t<option value=\"OUTROS\">Outros</option>\n";

				break;

		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

	function Campo_Turno($valor) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;Turno:</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\t\t<select name=\"turno\">\n";

		switch ($valor) {

			case "MATUTINO" :

				echo "\t\t<option value=\"MATUTINO\" selected>MATUTINO</option>\n" .
				"\t\t<option value=\"VESPERTINO\">VESPERTINO</option>\n" .
				"\t\t<option value=\"NOTURNO\">NOTURNO</option>\n";

				break;

			case "VESPERTINO" :

				echo "\t\t<option value=\"MATUTINO\">MATUTINO</option>\n" .
				"\t\t<option value=\"VESPERTINO\" selected>VESPERTINO</option>\n" .
				"\t\t<option value=\"NOTURNO\">NOTURNO</option>\n";

				break;

			case "NOTURNO" :

				echo "\t\t<option value=\"MATUTINO\">MATUTINO</option>\n" .
				"\t\t<option value=\"VESPERTINO\">VESPERTINO</option>\n" .
				"\t\t<option value=\"NOTURNO\" selected>NOTURNO</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"MATUTINO\">MATUTINO</option>\n" .
				"\t\t<option value=\"VESPERTINO\">VESPERTINO</option>\n" .
				"\t\t<option value=\"NOTURNO\" selected>NOTURNO</option>\n";

				break;

		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

	function Campo_Portador_Deficiencia($valor) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;Deficiência:</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\t\t<select name=\"deficiencia\">\n";

		switch ($valor) {

			case "NENHUMA DEFICIêNCIA" :

				echo "\t\t<option value=\"NENHUMA Deficiência\" selected>Nenhuma Deficiência</option>\n" .
				"\t\t<option value=\"Deficiência VISUAL\">Deficiência Visual</option>\n" .
				"\t\t<option value=\"Deficiência FISICA\">Deficiência Fisica</option>\n";

				break;

			case "DEFICIENTE VISUAL" :

				echo "\t\t<option value=\"NENHUMA Deficiência\">Nenhuma Deficiência</option>\n" .
				"\t\t<option value=\"Deficiência VISUAL\" selected>Deficiência Visual</option>\n" .
				"\t\t<option value=\"Deficiência FISICO\">Deficiência Fisica</option>\n";

				break;

			case "DEFICIENTE FISICA" :

				echo "\t\t<option value=\"NENHUMA Deficiência\">Nenhuma Deficiência</option>\n" .
				"\t\t<option value=\"Deficiência VISUAL\">Deficiência Visual</option>\n" .
				"\t\t<option value=\"Deficiência FISICA\" selected>Deficiência Fisica</option>\n";

				break;

			case "" :

				echo "\t\t<option value=\"NENHUMA Deficiência\" selected>Nenhuma Deficiência</option>\n" .
				"\t\t<option value=\"Deficiência VISUAL\">Deficiência Visual</option>\n" .
				"\t\t<option value=\"Deficiência FISICA\">Deficiência Fisica</option>\n";

				break;

		}

		echo "</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";
	}

	function Campo_Estados($nome, $nome_select, $valor) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;\n\t\t<select name=\"$nome_select\">\n\t\t<option value=\"AC\" >AC</option>\n\t\t<option value=\"AL\" >AL</option>\n\t\t<option value=\"AP\" >AP</option>\n\t\t<option selected value=\"AM\">AM</option>\n\t\t<option value=\"BA\" >BA</option>\n\t\t<option value=\"CE\" >CE</option>\n\t\t<option value=\"DF\" >DF</option>\n\t\t<option value=\"ES\" >ES</option>\n\t\t<option value=\"GO\" >GO</option>\n\t\t<option value=\"Ma\" >MA</option>\n\t\t<option value=\"MT\" >MT</option>\n\t\t<option value=\"MS\" >MS</option>\n\t\t<option value=\"MG\" >MG</option>\n\t\t<option value=\"PA\" >PA</option>\n\t\t<option value=\"PB\" >PB</option>\n\t\t<option value=\"PR\" >PR</option>\n\t\t<option value=\"PE\" >PE</option>\n\t\t<option value=\"PI\" >PI</option>\n\t\t<option value=\"RJ\" >RJ</option>\n\t\t<option value=\"RN\" >RN</option>\n\t\t<option value=\"RS\" >RS</option>\n\t\t<option value=\"RO\" >RO</option>\n\t\t<option value=\"RR\" >RR</option>\n\t\t<option value=\"SC\" >SC</option>\n\t\t<option value=\"SP\">SP</option>\n\t\t<option value=\"SE\" >SE</option>\n\t\t<option value=\"TO\" >TO</option>\n\t\t</select>\n\t</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Atencao($valor) {

		$String = "\t<tr bgcolor=\"#FF0000\">\n" .
		"\t<td width=\"\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp; ATENÇÃO: </td>\n" .
		"\t<td width=\"65%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao($nome, $valor) {

		if (!$valor == "" or !empty ($valor)) {

			$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
			"\t<td width=\"30%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ": </td>\n" .
			"\t<td width=\"\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $valor . "</td>\n" .
			"\t</tr>\n";

			echo $String;
		}

	}

	function Campo_Descricao_Data($nome, $data) {

		$_ano = substr($data, 0, 4);
		$_mes = substr($data, 5, 2);
		$_dia = substr($data, 8, 10);

		$Data = $_dia . "/" . $_mes . "/" . $_ano;

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ": </td>\n" .
		"\t<td width=\"85%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $Data . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_DB($nome, $SQL, $campo) {

		$Query = pg_query($SQL);
		$Obj = pg_fetch_object($Query);

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . ": </td>\n" .
		"\t<td width=\"65%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $Obj-> $campo . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Topo_Col3($valor, $valor1, $valor2) {

		$String = "\t<tr bgcolor=\"" . $this->CelCorTit . "\" >\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor . "</td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\20%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor2 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Col3($nome, $valor1, $valor2) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"60%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor2 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Topo_Grade($Periodo) {

		$String = "\t<tr bgcolor=\"" . $this->CelCorTit . "\" >\n" .
		"\t<td width=\"40%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp; " . $Periodo . "º Periodo / Disciplinas</td>\n" .
		"\t<td width=\"20%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp; Carga Horária</td>\n" .
		"\t<td width=\"40%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;Pré Requisito</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Grade($Disciplina, $Carga_Horaria, $PreRequisito) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"50%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $Disciplina . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $Carga_Horaria . "</td>\n" .
		"\t<td width=\"50%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $PreRequisito . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Topo_Col4($valor, $valor1, $valor2, $valor3) {

		$String = "\t<tr bgcolor=\"" . $this->CelCorTit . "\" >\n" .
		"\t<td width=\"55%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor2 . "</td>\n" .
		"\t<td width=\15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"TextoBrancoNegrito\">&nbsp;" . $valor3 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Col4($nome, $valor1, $valor2, $valor3) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"55%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor2 . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor3 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Descricao_Col6($nome, $valor1, $valor2, $valor3, $valor4, $valor5) {

		$String = "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"50%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor1 . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor2 . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor3 . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor4 . "</td>\n" .
		"\t<td width=\"10%\" height=\"" . $this->CelAlt . "\"  align=\"center\" class=\"Texto\">&nbsp;" . $valor5 . "</td>\n" .
		"\t</tr>\n";

		echo $String;

	}

	function Campo_Relatorio($NomeForm, $Acao, $ValorCampo, $SelectSala, $SelectSemestre) {

		$String = "\t<form name=\"" . $NomeForm . "\" action=\"?acao=" . $Acao . "\" method=\"POST\">\n" .
		"\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"\" 	 height=\"" . $this->CelAlt . "\" align=\"left\" class=\"Texto\">&nbsp;" . $ValorCampo . "</td>\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\" align=\"center\" >" . $SelectSemestre . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\" align=\"center\" >" . $SelectSala . "</td>\n" .
		"\t<td width=\"15%\" height=\"" . $this->CelAlt . "\" align=\"center\"><input type=\"submit\" value=\"Exibir Relat&oacute;rio\"></td>\n" .
		"\t</tr>\n" .
		"\t</form>\n";

		echo $String;

	}

	function Campo_Periodo($nome, $valor) {

		echo "\t<tr bgcolor=\"" . $this->CelCor . "\" ONMOUSEOVER=\"bgColor='" . $this->CelCorAtivo . "'\" ONMOUSEOUT=\"bgColor='" . $this->CelCor . "'\">\n" .
		"\t<td width=\"25%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" . $nome . "</td>\n" .
		"\t<td width=\"75%\" height=\"" . $this->CelAlt . "\"  align=\"left\" class=\"Texto\">&nbsp;" .
		"\t<select name=\"periodo\">" .
		"\t\t<option value=\"0\">SELECIONE</option>\n";

		for ($i = 1; $i <= 10; $i++) {

			if ($i == $valor) {

				echo "\t\t<option value=\"" . $i . "\" selected>" . $i . "</option>\n";

			} else {

				echo "\t\t<option value=\"" . $i . "\">" . $i . "</option>\n";

			}
		}

		echo "\t\t</select>\n" .
		"\t</td>\n" .
		"\t</tr>\n";

	}

//	 OUTRAS FUNCOES

	function Data_Brasileira() {

		$dia_ingles = date("l");

		switch ($dia_ingles) {

			case "Monday" :
				$dia_port = "Segunda-Feira";
				break;
			case "Tuesday" :
				$dia_port = "Terça-Feira";
				break;
			case "Wednesday" :
				$dia_port = "Quarta-Feira";
				break;
			case "Thursday" :
				$dia_port = "Quinta-Feira";
				break;
			case "Friday" :
				$dia_port = "Sexta-Feira";
				break;
			case "Saturday" :
				$dia_port = "Sábado";
				break;
			case "Sunday" :
				$dia_port = "Domingo";
				break;

		}

		$mes_ingles = date("n");

		switch ($mes_ingles) {

			case "1" :
				$mes_port = "Janeiro";
				break;
			case "2" :
				$mes_port = "Fevereiro";
				break;
			case "3" :
				$mes_port = "Março";
				break;
			case "4" :
				$mes_port = "Abril";
				break;
			case "5" :
				$mes_port = "Maio";
				break;
			case "6" :
				$mes_port = "Junho";
				break;
			case "7" :
				$mes_port = "Julho";
				break;
			case "8" :
				$mes_port = "Agosto";
				break;
			case "9" :
				$mes_port = "Setembro";
				break;
			case "10" :
				$mes_port = "Outubro";
				break;
			case "11" :
				$mes_port = "Novembro";
				break;
			case "12" :
				$mes_port = "Dezembro";
				break;

		}

		// DATA FORMATADA

		$Data = $dia_port . ", " . date("d") . " de " . $mes_port . " de " . date("Y");

		return $Data;

	}

	/**
	 * - Função Verifica String
	 * - Descricao: Contra SQL Injection 
	 * - Ex: vString($idProduto); 
	 */
	
	function vString($String) {

		$String = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"), "", $String);
		$String = trim($String);
		$String = strip_tags($String);
		$String = addslashes($String);

		return $String;

	}

}
?>
Return current item: Interfaces