<?php
ini_set('display_errors', 0);
require_once './Control/ControlOpIdioma.php';
//require_once './Control/ControlFoto.php';
require_once './Util/formAjax/FormAjax.php';
extract($_POST);
//var_dump($_POST);
if (!isset($lang))
{
	$lang = 'pt';
} else 
{
	if ($lang == 'undefined')
	{
		$lang = 'pt';
	}
}
$controlOpIdioma= new ControlOpIdioma();
if ($acao == 'inserir')
{
        echo 'Novo Registro...';
        $pk = '';
	$opIdioma = new Opidiomas();
} else
{
	$opIdioma = $controlOpIdioma->pegarUmOpIdioma($pk);
}
$arquivoGrid = 'adm_idiomaGrid.php';
?>
<form name="frm" id="frm" action="adm_idiomaCMD.php" method="post">
    <input id="hacao" name="acao" type="hidden" value="<?php echo $acao?>">
    <input id="arqFrm" name="arqFrm" type="hidden" value="<?php echo end(explode("/", $_SERVER['PHP_SELF']))?>">
	<fieldset>
		<label>Idioma</label>
		<section><label for="pk">ID</label>
                    <div><input  readonly="true" type="text" id="pk" name="pk" value="<?php echo $opIdioma->getOpidiomasid(); ?>" placeholder="Este campo é gerido de forma automática."></div>
		</section>
                <section><label for="txtTitulo">Nome</label>
                    <div><input type="text" id="txtNome" name="txtNome" required value="<?php echo $opIdioma->getNome(); ?>"></div>
		</section>
                <section><label for="txtLang">Sigla</label>
                    <div><input type="text" id="txtLang" name="txtLang" required value="<?php echo $opIdioma->getLang(); ?>"></div>
		</section>
                <section><label for="txtFormatoData">Formato de Data</label>
                    <div><input type="text" id="txtFormatoData" name="txtFormatoData" required value="<?php echo $opIdioma->getFormatodata(); ?>"></div>
		</section>
                <section><label for="txtLang">Símbolo decimal</label>
                    <div><input type="text" id="txtSimboloDecimal" name="txtSimboloDecimal" required value="<?php echo $opIdioma->getSimbolodecimal(); ?>"></div>
		</section>
                <section><label for="txtLang">Símbolo Moeda</label>
                    <div><input type="text" id="txtSimboloMoeda" name="txtSimboloMoeda" required value="<?php echo $opIdioma->getSimbolomoeda(); ?>"></div>
		</section>
                <section>
                    <div><button onclick="mostrarArquivo('<?php echo $arquivoGrid; ?>','#dados');" >Cancelar</button><button id="salvar" class="submit" name="submitbuttonname" value="submitbuttonvalue">Salvar</button></div>
		</section>
	</fieldset>
</form>
<?php
      FormAjax::javascriptTrocarIdioma('adm_idiomaForm.php');
      FormAjax::PrepararFormAjax('#frm');
?>