<?php
ini_set('display_errors', 0);
require_once './Control/ControlMedia.php';
require_once './Util/formAjax/FormAjax.php';
extract($_POST);
//var_dump($_POST);
if (!isset($lang))
{
	$lang = 'pt';
} else 
{
	if ($lang == 'undefined')
	{
		$lang = 'pt';
	}
}
$controlMedia = new ControlMedia();
if ($acao == 'inserir')
{
        echo 'Novo Registro...';
        $pk = '';
	$tipoMedia = new Tipomedia();
} else
{
	$tipoMedia = $controlMedia->pegarUmTipomedia($pk);
}
$tipoMedia->lang = $lang;
$arquivoGrid = 'adm_tipoMediaGrid.php';
?>
<form name="frm" id="frm" action="adm_tipoMediaCMD.php" method="post">
    <input id="hacao" name="acao" type="hidden" value="<?php echo $acao?>">
    <input id="lang" name="lang" type="hidden" value="<?php echo $lang?>">
    <input id="arqFrm" name="arqFrm" type="hidden" value="<?php echo end(explode("/", $_SERVER['PHP_SELF']))?>">
	<fieldset>
		<label>Tipo de Mídia</label>
                <?php echo Idiomas::ComboSelecionarIdiomaPainelControle($acao, $pk, $lang);?>
		<section><label for="pk">ID</label>
                    <div><input  readonly="true" type="text" id="pk" name="pk" value="<?php echo $tipoMedia->getTipomediaid(); ?>" 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 $tipoMedia->gNome(); ?>"></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_tipoMediaForm.php');
      FormAjax::PrepararFormAjax('#frm');
?>