<?php
include_once(getabspath("include/senuc_aluno_settings.php"));

function DisplayMasterTableInfo_senuc_aluno($params)
{
	$detailtable = $params["detailtable"];
	$keys = $params["keys"];
	$detailPageObj = $params["detailPageObj"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	$oldTableName = $strTableName;
	$strTableName = "senuc_aluno";
	
	$settings = new ProjectSettings($strTableName, PAGE_LIST);
	$cipherer = new RunnerCipherer($strTableName);
	
	$masterQuery = $settings->getSQLQuery();
	
	$viewControls = new ViewControlsContainer($settings, PAGE_LIST);

$where = "";
$mKeys = array();
$showKeys = "";

global $page_styles, $page_layouts, $page_layout_names, $container_styles;

$layout = new TLayout("masterlist","BreezeAqua1","MobileAqua1");
$layout->blocks["bare"] = array();
$layout->containers["0"] = array();

$layout->containers["0"][] = array("name"=>"masterlistheader","block"=>"","substyle"=>1);


$layout->skins["0"] = "empty";
$layout->blocks["bare"][] = "0";
$layout->containers["mastergrid"] = array();

$layout->containers["mastergrid"][] = array("name"=>"masterlistfields","block"=>"","substyle"=>1);


$layout->skins["mastergrid"] = "grid";
$layout->blocks["bare"][] = "mastergrid";$page_layouts["senuc_aluno_masterlist"] = $layout;


if($detailtable == "senuc_frequencias")
{
		$where.= GetFullFieldName("cpf", "", false)."=".$cipherer->MakeDBValue("cpf",$keys[1-1], "", "", true);
	$showKeys .= " "."Cpf".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
if($detailtable == "senuc_atividades_aluno")
{
		$where.= GetFullFieldName("id", "", false)."=".$cipherer->MakeDBValue("id",$keys[1-1], "", "", true);
	$showKeys .= " "."Id".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
if($detailtable == "senuc_plantoes_aluno")
{
		$where.= GetFullFieldName("id", "", false)."=".$cipherer->MakeDBValue("id",$keys[1-1], "", "", true);
	$showKeys .= " "."Id".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
if($detailtable == "senuc_contribuicoes")
{
		$where.= GetFullFieldName("id", "", false)."=".$cipherer->MakeDBValue("id",$keys[1-1], "", "", true);
	$showKeys .= " "."Id".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
if($detailtable == "senuc_descomplica")
{
		$where.= GetFullFieldName("id", "", false)."=".$cipherer->MakeDBValue("id",$keys[1-1], "", "", true);
	$showKeys .= " "."Id".": ".$keys[1-1];
	$xt->assign('showKeys',$showKeys);
}
	if(!$where)
	{
		$strTableName = $oldTableName;
		return;
	}
	$str = SecuritySQL("Search");
	if(strlen($str))
		$where.= " and ".$str;

	$strWhere = whereAdd($masterQuery->WhereToSql(),$where);
	if(strlen($strWhere))
		$strWhere = " where ".$strWhere." ";
	$strSQL = $masterQuery->HeadToSql().' '.$masterQuery->FromToSql().$strWhere.$masterQuery->TailToSql();

//	$strSQL = AddWhere($strSQL,$where);
	LogInfo($strSQL);
	$rs = db_query($strSQL,$conn);
	$data = $cipherer->DecryptFetchedArray($rs);
	if(!$data)
	{
		$strTableName = $oldTableName;
		return;
	}
	$keylink = "";
	$keylink.="&key1=".htmlspecialchars(rawurlencode(@$data["id"]));
	

//	id - 
			$value="";

					$xt->assign("id_mastervalue", $viewControls->showDBValue("id", $data, $keylink));

//	idnucleo - 
			$value="";

					$xt->assign("idnucleo_mastervalue", $viewControls->showDBValue("idnucleo", $data, $keylink));

//	nome - 
			$value="";

					$xt->assign("nome_mastervalue", $viewControls->showDBValue("nome", $data, $keylink));

//	endereco - 
			$value="";

					$xt->assign("endereco_mastervalue", $viewControls->showDBValue("endereco", $data, $keylink));

//	email - 
			$value="";

					$xt->assign("email_mastervalue", $viewControls->showDBValue("email", $data, $keylink));

//	cpf - Custom
			$value="";

					$xt->assign("cpf_mastervalue", $viewControls->showDBValue("cpf", $data, $keylink));

//	telefone - 
			$value="";

					$xt->assign("telefone_mastervalue", $viewControls->showDBValue("telefone", $data, $keylink));

//	celular - 
			$value="";

					$xt->assign("celular_mastervalue", $viewControls->showDBValue("celular", $data, $keylink));

//	operadora - 
			$value="";

					$xt->assign("operadora_mastervalue", $viewControls->showDBValue("operadora", $data, $keylink));

//	cidade - 
			$value="";

					$xt->assign("cidade_mastervalue", $viewControls->showDBValue("cidade", $data, $keylink));

//	estado - 
			$value="";

					$xt->assign("estado_mastervalue", $viewControls->showDBValue("estado", $data, $keylink));

//	etnia - 
			$value="";

					$xt->assign("etnia_mastervalue", $viewControls->showDBValue("etnia", $data, $keylink));

//	nascimento - Custom
			$value="";

					$xt->assign("nascimento_mastervalue", $viewControls->showDBValue("nascimento", $data, $keylink));

//	nota_cidadania - 
			$value="";

					$xt->assign("nota_cidadania_mastervalue", $viewControls->showDBValue("nota_cidadania", $data, $keylink));

//	renda - 
			$value="";

					$xt->assign("renda_mastervalue", $viewControls->showDBValue("renda", $data, $keylink));

//	escolaridade - 
			$value="";

					$xt->assign("escolaridade_mastervalue", $viewControls->showDBValue("escolaridade", $data, $keylink));

//	preparar_para - 
			$value="";

					$xt->assign("preparar_para_mastervalue", $viewControls->showDBValue("preparar_para", $data, $keylink));

//	ingresso_nucleo - Short Date
			$value="";

					$xt->assign("ingresso_nucleo_mastervalue", $viewControls->showDBValue("ingresso_nucleo", $data, $keylink));

//	acoes_afirmativas - 
			$value="";

					$xt->assign("acoes_afirmativas_mastervalue", $viewControls->showDBValue("acoes_afirmativas", $data, $keylink));

//	ativo - Checkbox
			$value="";

					$xt->assign("ativo_mastervalue", $viewControls->showDBValue("ativo", $data, $keylink));

//	motivo - Custom
			$value="";

					$xt->assign("motivo_mastervalue", $viewControls->showDBValue("motivo", $data, $keylink));

//	id_mdl - 
			$value="";

					$xt->assign("id_mdl_mastervalue", $viewControls->showDBValue("id_mdl", $data, $keylink));

//	idregional - 
			$value="";

					$xt->assign("idregional_mastervalue", $viewControls->showDBValue("idregional", $data, $keylink));

//	ultimo_score - Custom
			$value="";

					$xt->assign("ultimo_score_mastervalue", $viewControls->showDBValue("ultimo_score", $data, $keylink));

//	data_ultimo_score - Custom
			$value="";

					$xt->assign("data_ultimo_score_mastervalue", $viewControls->showDBValue("data_ultimo_score", $data, $keylink));

//	score - 
			$value="";

					$xt->assign("score_mastervalue", $viewControls->showDBValue("score", $data, $keylink));

//	id_turma - 
			$value="";

					$xt->assign("id_turma_mastervalue", $viewControls->showDBValue("id_turma", $data, $keylink));

//	data_atualiza - Short Date
			$value="";

					$xt->assign("data_atualiza_mastervalue", $viewControls->showDBValue("data_atualiza", $data, $keylink));

	$viewControls->addControlsJSAndCSS();
	$detailPageObj->viewControlsMap['mViewControlsMap'] = $viewControls->viewControlsMap;

	$layout = GetPageLayout("senuc_aluno", 'masterlist');
	if($layout)
		$xt->assign("pageattrs", 'class="'.$layout->style." page-".$layout->name.'"');
	
	$xt->display("senuc_aluno_masterlist.htm");
	
	$strTableName=$oldTableName;
}

?>