<?php

include("db.php");

$id="";

if(isset($_SESSION["user"]["uid"]))$id=$_SESSION["user"]["uid"];
else{
  redirect(URL_ROOT."index.php");
}


$profiledetail=$objindex->profile($_SESSION['user']['uid']);

$complain=$db->getRow("select * from complain where id=".$_REQUEST['id']);
$complain['complain_date']=ago($complain['udate']);
$smarty->assign("cmpln",$complain);

$smarty->display('complain_detail.html');

/*<?php
include("db.php");

$id="";

if(isset($_SESSION["user"]["uid"]))$id=$_SESSION["user"]["uid"];
else{
  redirect(URL_ROOT."index.php");
}

$profiledetail=$objindex->profile($_SESSION['user']['uid']);

    
if(isset($_POST['submit']))
{
 if($_POST['topic']=="")
 {
	array_push($alert_err,"Please enter Topic "); }elseif($_POST['detail']==""){
	array_push($alert_err,"Please enter Details"); }
 else{
	 $aryData=array(
		 "topic"=>$_POST['topic'],
		 "detail"=>$_POST['detail'],
		 "student_id"=>$profiledetail['idno'],
		 "school_id"=>$profiledetail['school_id']
	 );

  $insert_complain=$db->insertAry("complain",$aryData);
//insertion complete  
  if($insert_complain>0){
	   $smarty->assign("complain_insertion",1);
	  }else{
	  echo $db->getErMsg();exit;
	  }
 } 
}
$smarty->assign("profile",$profiledetail);

$smarty->assign("error",$alert_err);

$profile=$objindex->profile($_SESSION['user']['uid']);

$smarty->assign("mycomplains",$objindex->complain($_SESSION['user']['uid']));

$smarty->display('complain.html');*/