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

function DisplayMasterTableInfo_senuc_plantoes($params)
{
	$detailtable = $params["detailtable"];
	$keys = $params["keys"];
	$detailPageObj = $params["detailPageObj"];
	global $conn,$strTableName;
	$xt = new Xtempl();
	$oldTableName = $strTableName;
	$strTableName = "senuc_plantoes";
	
	$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_plantoes_masterlist"] = $layout;


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(!$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_professor - 
			$value="";

					$xt->assign("id_professor_mastervalue", $viewControls->showDBValue("id_professor", $data, $keylink));

//	materia - 
			$value="";

					$xt->assign("materia_mastervalue", $viewControls->showDBValue("materia", $data, $keylink));

//	dias_semana - Checkbox
			$value="";

					$xt->assign("dias_semana_mastervalue", $viewControls->showDBValue("dias_semana", $data, $keylink));

//	hora_inicio - Time
			$value="";

					$xt->assign("hora_inicio_mastervalue", $viewControls->showDBValue("hora_inicio", $data, $keylink));

//	hora_fim - Time
			$value="";

					$xt->assign("hora_fim_mastervalue", $viewControls->showDBValue("hora_fim", $data, $keylink));

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

					$xt->assign("data_insert_mastervalue", $viewControls->showDBValue("data_insert", $data, $keylink));

//	id_nucleo - 
			$value="";

					$xt->assign("id_nucleo_mastervalue", $viewControls->showDBValue("id_nucleo", $data, $keylink));

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

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

?>