<?php
$pgMod="question";
$pgAct="view";

if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);

//echo "$pgAct";exit;


if($_POST)
{


	if($_POST['post_type']=='addexcel')
	{
		
		
		$classname=$_REQUEST['classname'];

		$subjectname=$_REQUEST['subjectname'];

		$topic=$_REQUEST['topic'];
		

		if(trim($classname)=="" && $classname==0)
		{
		 array_push($alert_err," Please select class ");
		}elseif($subjectname==0 && trim($subjectname)==""){

		 array_push($alert_err," Please select subject ");
		}
		
		$insq=0;$upsq=0;
		
		if(isset($_FILES["excel"]["name"]) && !empty($_FILES["excel"]["name"]))

		{
			$getWorksheetName = array();

			$lfilename = basename($_FILES['excel']['name']);

			$lext = strtolower(substr($lfilename, strrpos($lfilename, '.')+1));

			if(in_array($lext,array('xlsx')))

			{

				$xlsx = new SimpleXLSX( $_FILES['excel']['tmp_name'] );

				$getWorksheetName = $xlsx->getWorksheetName();

				$datas = $xlsx->rows(1);$ii=0;

				if($_REQUEST["totalqus"]!=count($datas)){

					echo "error==>Please Select ".$_POST['totalqus']." questions but you have select only ".count($datas)." questions.";exit;

				}

				elseif(is_array($datas) && count($datas)>0){

					foreach($datas as $data){

					$datasAry=array();

					$option=array();

					$checkexist="";

//$checkexist=$db->getVal("select id from student_list where inst_name='".$_SESSION["school"]["uid"]."' and enrollment_no='".$data[2]."'");

					$question="";

					if(trim($data['0'])!="")
					{

					$question=array("type"=>"text","question"=>POST($data[0]));

					$option[] = array("type"=>"text","answer"=>POST($data[1]));

					$option[] = array("type"=>"text","answer"=>POST($data[2]));

					$option[] = array("type"=>"text","answer"=>POST($data[3]));

					$option[] = array("type"=>"text","answer"=>POST($data[4]));	

						

					$answerO="";

					if(strtolower($data[5])=="a")$answerO=$data[1];

					elseif(strtolower($data[5])=="b")$answerO=$data[2];

					elseif(strtolower($data[5])=="c")$answerO=$data[3];

					elseif(strtolower($data[5])=="d")$answerO=$data[4];

					//echo "error==>";echo "<pre>";print_r($option);exit;

					$status=0;

					if(isset($_POST["status"]))$status=1;

					$aryData=array(	'class'	=>	$classname ,

									'subject'	=> $subjectname ,

									'question'	=>	json_encode($question),

									'options'	=>	json_encode($option),

									'answer'	=>	POST($answerO),

									

'topic'     => $topic,

									'status'	=>	1,

									'added_by'   =>$_SESSION['admin']['uid'],
									'school_id'   =>$_SESSION['admin']['school_id'],

									);

						if(count($aryData['question'])!=0 && $aryData['answer']!="")

						{

						$checkexist=$db->getVal("Select id from ".QUESTION." where question='".$aryData['question']."' and class and subject='".$aryData['question']."'");								if($checkexist=="")

					if($checkexist!=""){

						$qentry=$db->insertAry("question",$aryData);

													if($qentry=="")

													{

														$qerrors[]=$db->getErMsg();

													}

													else{	

														$insq+=1;	

													}

						

										}

										else{

						

						$qentry=$db->updateAry("question",$aryData," where question=".$checkexist);

										

											if($qentry=="")

													{

													$qerrors[]=$db->getErMsg();

													}else{

														

													$upsq+=1;	

													}


										}

						}			

					}

				}

//	echo "success==>file has been successfully uploaded $insq Q Inserted $upsq Q Updated ==>".PATH_ADMIN;
				$_SESSION['msg']="file has been successfully uploaded $insq Q Inserted $upsq Q Updated ";
			unset($_SESSION['form']);
			redirect(URL_ADMIN_HOME.getQueryString(array("page_id"=>$pgMod)));

			}else{

				echo "File error ".$handle ;

			}



			

			}else{

						array_push($alert_err," file must in excel format");

			}

		}else{
				array_push($alert_err,"Please select file");

		}
	
	}
	else{
	 	
//echo "error hai ";exit;	
	$_SESSION['form']=$_POST;
	$flgEr=FALSE;
	
		if(!isset($_POST['Name']) || trim($_POST['Name'])=='')

		if(!isset($_POST['classname']) || trim($_POST['classname'])=='')

		{

			$flgEr=TRUE;

			echo "error==>Please Select class name";

		}elseif(!isset($_POST['subjectname']) || trim($_POST['subjectname'])=='')

		{

			$flgEr=TRUE;

			echo "error==>Please Select subject name";

		}

		elseif(!isset($_POST['question']) || trim($_POST['question'])=='')

		{

			$flgEr=TRUE;

			echo "error==>Please enter Question";

		}

		elseif(!is_array($_POST["attr_ans"]) || count($_POST["attr_ans"])<=0){

			$flgEr=TRUE;

			echo "error==>Please enter Atleast one option";

		}

		elseif(!isset($_POST['answer']) || trim($_POST['answer'])=='')

		{
			$flgEr=TRUE;

			echo "error==>Please Select answer";

		}
		else
		{

			$question_type="text";$question=array();$option=array();

			if(isset($_POST['check_question']) && trim($_POST['check_question'])=='1')$question_type="image";

			$question=array("type"=>$question_type,"question"=>POST("question"));

			if(is_array($_POST["attr_ans"]) && count($_POST["attr_ans"])>0)

			{
				for($i=0; $i<=count($_POST['attr_ans'])-1; $i++)
				{
					if($_POST["attr_ans"][$i]!="" && $_POST['attr_ans'][$i]!=""){

						$option[] = array(	

								"type"=>POST($_POST['attr_type'][$i]),

								"answer"=>POST($_POST['attr_ans'][$i])						

						);

					}

				}

			}

			//echo "error==>";echo "<pre>";print_r($option);exit;

			$status=0;

			if(isset($_POST["status"]))$status=1;

			$aryData=array(	'class'	=>	POST('classname'),

							'subject'	=>	POST('subjectname'),

							'question'	=>	json_encode($question),

							'options'	=>	json_encode($option),

							'answer'	=>	POST('answer'),

							'status'	=>	$status,

							'added_by'   =>$_SESSION['admin']['uid'],
							'school_id'   =>$_SESSION['admin']['school_id'],

							);

			 $flgIn=$db->insertAry("question",$aryData);

			if(!is_null($flgIn))

	   if(!is_null($flgIn))
	   {
			$_SESSION['msg']='Saved Successfully';
			unset($_SESSION['form']);
			redirect(URL_ADMIN_HOME.getQueryString(array("page_id"=>$pgMod)));
		}
		else
		{
			array_push($alert_err,$db->getErMsg());
			
		}
		}		
	
		if($flgEr!=TRUE && $pgAct=="add")
		{
		
           $_POST["added_by"]=$_SESSION["admin"]["uid"];
		   if(isset($_POST['status']))
			$_POST["status"]=1;
			else $_POST["status"]=0;
			
	   $flgIn=$db->insertAry("content_head",$_POST);
	   if(!is_null($flgIn))
	   {
			$_SESSION['msg']='Saved Successfully';
			unset($_SESSION['form']);
			redirect(URL_ADMIN_HOME.getQueryString(array("page_id"=>$pgMod)));
		}
		else
		{
			array_push($alert_err,$db->getErMsg());
			
		}
	}
		elseif($pgAct=="edit" && isset($_GET['id']) && trim($_GET['id'])!='')
		{
		$flgUp=$db->updateAry("question",$_POST,"where school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_GET['id']."'");
		if(!is_null($flgUp))
		{
			$_SESSION['msg']='update Successfully';
			unset($_SESSION['form']);
			redirect(URL_ADMIN_HOME.getQueryString(array("page_id"=>$pgMod)));
		}
		else
		{
			array_push($alert_err,$db->getErMsg());
		
		}
	}  
	}
}		
elseif($pgAct=="delete" && isset($_GET['id']) && trim($_GET['id'])!='')
{
	
	//echo"==>error<pre>";print_r($iList);exit;
	$res=$db->delete("question","where  id='".$_GET['id']."'");
	if(!is_null($res)) { $_SESSION['msg']='Deleted Successfully'; }
	else { array_push($alert_err,$db->getErMsg()); }
	redirect(URL_ADMIN_HOME.getQueryString(array("page_id"=>$pgMod)));
} 
if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
if($pgAct=="addexcel")
{
	//echo "<pre>";print_r($aryForm);echo "</pre>".$aryForm['root'];
?>
<!-- Forms --> 
<script language="javascript">
function getsubname()
{
var c=$("#classname").val();
$.post("ajax.php",{type:"getsubname",clsname:c},function(data){
		$("#subdiv").html(data);
	});
}
</script>
	<div class="row-fluid">
        <form method="post" enctype="multipart/form-data" action="">
			<!-- Forms: Box -->
			<div class="span12">

				<!-- Forms: Top Bar -->
				<div class="top-bar">
					<h3><i class="icon-cog"></i> Add new Question</h3>
				</div>
				<!-- / Forms: Top Bar -->

				<!-- Forms: Content -->
				<div class="well no-padding">

					<div class="control-group">
      <label class="control-label" for="type">Class Name  </label>
      
      <div class="controls">
        <select  id="classname"   name="classname" onchange="getsubname('classname')" >
          <option value="0" >Select</option>
          <?php
          $sliderContent=$db->getRows("select class from class where school_id=".$_SESSION['admin']['school_id']);
		  foreach($sliderContent as $sdetail){
				?>
          <option  value="<?php echo $sdetail['class'];?>" <?php  if($aryForm['class']==$sdetail['class'])echo 'selected="selected"';?> ><?php echo $sdetail['class'];?></option>
          <?php } ?>
        </select>
        <?php if($pgAct=="edit" && isset($_REQUEST['id']) && trim($_REQUEST['id']) !=''){
        ?>
        
        <?php } ?>
      </div>
    </div>
                    
                    <div class="control-group">
                      <label class="control-label" for="type">Subject Name</label>
                      <div class="controls" id="subdiv">
                        <select  id="subjectname"  class="form-control" name="subjectname">
                          <option value="0" >Please select Class name first</option>
                        </select>
                      </div>
                    </div>
                  
                    
                    <div class="control-group">
                      <label class="control-label" for="question">Add Excel</label>
                        <div class="controls">
                            <div class="input-group">
                                <input type="file" class="form-control" name="excel"  >
                                 
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    
                    <div class="control-group">
                      <label class="control-label" for="question"> Topic  </label>
                        <div class="controls">
                            <div class="input-group">
                                <input type="text" class="form-control" name="topic"  > 
                                 
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    
                    <div class="control-group">
                      <label class="control-label" for="question">Total Questions</label>
                        <div class="controls">
                            <div class="input-group">
                                <input type="number" class="form-control" name="totalqus"  >
                                 
                            </div>
                        </div>
                    </div>
                    
                   <!-- <div class="control-group">
                      <label class="control-label" for="question"> Activate  </label>
                        <div class="controls">
                            <div class="input-group">
                                <input type="checkbox" class="form-control" name="status"  > please check if you want to activate it !
                                 
                            </div>
                        </div>
                    </div>-->
                
					<div class="form-actions">
                        	<input type="hidden" name="post_type"  value="addexcel">
							<button type="submit" class="btn btn-primary"> Save</button>
							<button type="button" class="btn"> Cancel</button>
						</div>
                        
				</div>
				<!-- / Forms: Content -->

			</div>
			<!-- / Forms: Box -->

        </form>
	</div>
<?php
//exit;   
}if($pgAct=="edit" && $_GET["id"]!="")
{   
	$aryForm=$db->getRow("SELECT * FROM question WHERE school_id='".$_SESSION["admin"]["school_id"]."' and id='".$_GET['id']."'");
//echo"<pre>".$db->getLastQuery();print_r($aryForm);exit;
}
if($pgAct=="add" || ($pgAct=="edit" && isset($_GET['id']) && trim($_GET['id']) !=''))
{
	//echo "<pre>";print_r($aryForm);echo "</pre>".$aryForm['root'];
?>
<!-- Forms --> 
<script language="javascript">
function getsubname()
{
var c=$("#classname").val();
$.post("ajax.php",{type:"getsubname",clsname:c},function(data){
		$("#subdiv").html(data);
	});
}
</script>
<script>///////******************************Question page jquery************************//////////////////

function ans_radio(){
	$(".ans_radio").each(function(){
		$(this).change(function(){
			var answer=$(this).parent("span").parent("div").children(".form-control").val();
			if(answer==""){
				$(this).removeAttr("checked")
				alert("Please enter answer first")
			}else
			$("#answer").val(answer);
		});
	})
}
$(document).ready(function(){
	getsubname();
	ans_radio();
});

///////******************************Question page jquery************************//////////////////</script>
<input id="hs" type="hidden" value="hrs">
	<div class="row-fluid">
        <form method="post" enctype="multipart/form-data" action="">
			<!-- Forms: Box -->
			<div class="span12">

				<!-- Forms: Top Bar -->
				<div class="top-bar">
					<h3><i class="icon-cog"></i> Add new Question</h3>
				</div>
				<!-- / Forms: Top Bar -->

				<!-- Forms: Content -->
				<div class="well no-padding">

					<div class="control-group">
      <label class="control-label" for="type">Class Name  </label>
      
      <div class="controls">
        <select  id="classname"   name="classname" onchange="getsubname('classname')" >
          <option value="0" >Select</option>
          <?php
          $sliderContent=$db->getRows("select class from class where school_id=".$_SESSION['admin']['school_id']);
		  foreach($sliderContent as $sdetail){
				?>
          <option  value="<?php echo $sdetail['class'];?>" <?php  if($aryForm['class']==$sdetail['class'])echo 'selected="selected"';?> ><?php echo $sdetail['class'];?></option>
          <?php } ?>
        </select>
        <?php if($pgAct=="edit" && isset($_REQUEST['id']) && trim($_REQUEST['id']) !=''){
        ?>
        
        <?php } ?>
      </div>
    </div>
                    <div class="control-group">
                      <label class="control-label" for="type">Subject Name</label>
                      <div class="controls" id="subdiv">
                        <select  id="subjectname"  class="form-control" name="subjectname">
                          <option value="0" >Please select Class name first</option>
                        </select>
                      </div>
                    </div>
                    
                    <div class="control-group">
                      <label class="control-label" for="question">Question</label><?php
                      $question=json_decode($aryForm["question"],true);
                      ?>
                        <div class="controls">
                            <div class="input-group">
                                <input type="text" class="form-control" name="question" value="<?php echo $question["question"]; ?>" placeholder="Enter Url if image else enter Direct Question">
                                 <span class="input-group-addon" data-toggle="tooltip" title="check if question is in image formate">
                                  <input type="checkbox" name="check_question" value="1" <?php if($question["type"]=="image")echo 'checked="checked"'; ?>> check if image is in image format
                                </span>
                            </div><!-- /input-group -->
                        </div>
                    </div>
                    
                    <div class="control-group">
                      <input type="hidden" name="answer" id="answer" value="<?php echo $aryForm["answer"] ?>" />	
                      <label class="control-label" for="email">Answer </label>
                      <div class="controls" id="answer_div">
                            <a href="javascript:;" id="add">Add New Answer</a> <small>(Select correct Answer from all)</small><?php
                            $option=json_decode($aryForm["options"],true);
                            if(is_array($option) && count($option)>0){
                                foreach($option as $op){
                                    ?><div class="input-group">
                                <span class="input-group-addon">
                                  <input type="radio" name="ans" class="ans_radio" <?php if($op["answer"]==$aryForm["answer"])echo 'checked="checked"'; ?> >
                                </span>
                                
                                <input type="text" class="form-control"  name="attr_ans[]" value="<?php echo $op["answer"] ?>" placeholder="Enter Url if image else enter Diect Answer">
                                <span class="input-group-addon" style="padding:0">
                                  <select name="attr_type[]" style="height:32px !important"><option value="text" <?php if($op["type"]=="text")echo 'selected="selected"'; ?>>Text</option><option value="image" <?php if($op["type"]=="image")echo 'selected="selected"'; ?>>Image</option></select>
                                </span>
                                <span class="input-group-addon"><a href="#" class="delete" data-toggle="tooltip" title="remove"><i class="fa fa-times"></i></a></span>
                            </div><!-- /input-group --><?php
                                }
                            }else{
                            ?>
                            <div class="input-group">
                                <span class="input-group-addon">
                                  <input type="radio" name="ans" class="ans_radio">
                                </span>
                                
                                <input type="text" class="form-control"  name="attr_ans[]" placeholder="Enter Url if image else enter Diect Answer">
                                <span class="input-group-addon" style="padding:0">
                                  <select name="attr_type[]" style="height:32px !important"><option value="text">Text</option><option value="image">Image</option></select>
                                </span>
                                <span class="input-group-addon"><a href="#" class="delete" data-toggle="tooltip" title="remove"><i class="fa fa-times"></i></a></span>
                            </div><!-- /input-group -->
                            <div class="input-group">
                                <span class="input-group-addon">
                                  <input type="radio" name="ans" class="ans_radio">
                                </span>
                                <input type="text" class="form-control" name="attr_ans[]" placeholder="Enter Url if image else enter Diect Answer">
                                <span class="input-group-addon" style="padding:0">
                                  <select name="attr_type[]" style="height:32px !important"><option value="text">Text</option><option value="image">Image</option></select>
                                </span>
                                <span class="input-group-addon"><a href="#"  class="delete" data-toggle="tooltip" title="remove"><i class="fa fa-times"></i></a></span>
                            </div><!-- /input-group -->
                            <div class="input-group">
                                <span class="input-group-addon">
                                  <input type="radio" name="ans" class="ans_radio">
                                </span>
                                <input type="text" class="form-control" name="attr_ans[]" placeholder="Enter Url if image else enter Diect Answer">
                                <span class="input-group-addon" style="padding:0">
                                  <select name="attr_type[]" style="height:32px !important"><option value="text">Text</option><option value="image">Image</option></select>
                                </span>
                                <span class="input-group-addon"><a href="#"  class="delete" data-toggle="tooltip" title="remove"><i class="fa fa-times"></i></a></span>
                            </div><!-- /input-group -->
                            <div class="input-group">
                                <span class="input-group-addon">
                                  <input type="radio" name="ans" class="ans_radio">
                                </span>
                                <input type="text" class="form-control" name="attr_ans[]" placeholder="Enter Url if image else enter Diect Answer">
                                <span class="input-group-addon" style="padding:0">
                                  <select name="attr_type[]" style="height:32px !important"><option value="text">Text</option><option value="image">Image</option></select>
                                </span>
                                <span class="input-group-addon"><a href="#"  class="delete" data-toggle="tooltip" title="remove"><i class="fa fa-times"></i></a></span>
                            </div><!-- /input-group -->
                            <?php
                            }?>
                      </div>
                    </div>
                    
                    <!--<div class="control-group">
                      <label class="control-label" for="header" > Status </label>
                      <div class="controls">
                        <div class="make-switch" data-on="success" data-off="danger" >
                          <input name="status" type="checkbox" value="1" <?php if($aryForm['status']==1)echo "checked"; ?> >
                          Activate this Page ? </div>
                      </div>
                    </div>-->
					
                    <div class="form-actions">
                        
							<button type="submit" class="btn btn-primary"> Save</button>
							<button type="button" class="btn"> Cancel</button>
						</div>
                        
				</div>
				<!-- / Forms: Content -->

			</div>
			<!-- / Forms: Box -->

        </form>
	</div>
<?php   
}else{
	?>
<style>
.clsth{
		width:15% !important;
		padding:5px !important;
 }
.qsth{
	width:15% !important;
	padding:1px !important;	
	} 
</style>


<link href="<?php echo $LinksDetails["url_root"];?>assets/css/custom.css" rel="stylesheet" type="text/css" />

    
	<div class="row-fluid"><div class="span12"><div class="top-bar">
    <h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
    <button style="float:right; margin-top:5px" onClick="window.location='./?page_id=<?php echo $pgMod; ?>&action=addexcel'" class="btn" type="button">Add Excel</button>
    <button style="float:right; margin-top:5px" onClick="window.location='./?page_id=<?php echo $pgMod; ?>&action=add'" class="btn" type="button">Add <?php echo $pgMod; ?></button>
    </div>
    <div class="well no-padding">
    
   
     <?php
	{
		
		//$aryList=$db->getRows("SELECT * FROM question ");
		$aryPgAct=array("page_id"=>$pgMod);
		
			$range=$LinksDetails["record_per_page"];
		//$range=20;
		
		$page="";$filterAry=array();
		if(isset($_GET["range"]))$range=$_GET["range"];
		if(isset($_GET['nextpage'])) $page=$_GET['nextpage'];
		if (isset($_GET['search']))
		{
			$search = $_GET['search'];
			$filterAry[] =" (class like '%" . $search . "%' or subject like '%" . $search . "%' or answer like '%" . $search . "%' ) ";
		
		}
		if (isset($_GET['online']))
		{
			$filterAry[] =" is_online=1 ";
		}
		if (isset($_GET['pending']))
		{
			$filterAry[] =" status=1 ";
		}
		if (isset($_GET['active']))
		{
			$filterAry[] =" status=2 ";
		}
		if(is_array($filterAry) && count($filterAry)>0)$sqlfilter=implode(" AND ",$filterAry);
		if($sqlfilter=="")$sqlfilter =" 1 ";
		$pagination['table']		=	"question" ;
		$pagination['targetpage']	=	"index.php" ;
		$pagination['sqlfilter']	=	$sqlfilter ;
		$pagination['size']			=	$range;
		$pagination['nextpage']		= 	$page ;
		$pagination['option']		= 	"page_id=".$pgMod ;
		$resultData 				= 	$objPagination->getData($pagination);
		$i=0;
	//print_r($resultData);
	
	//echo"error==><pre>yesss";echo $db->getLastQuery();exit;
		$aryList=$resultData["data"];//$db->getRows($sql);
		//echo"error==><pre>";echo $db->getLastQuery();exit;
		//$sqlLimit="SELECT * FROM ".EVENT." ORDER BY event_id ASC ";
		//$aryList=$db->getRows($sqlLimit);
		if(is_array($aryList))
		{
		  if(count($aryList)>0)
		   { 
			 ?>
        <div class="pull-right">
          <form method="get" action="index.php" style="float:right; margin:3px;">
            <div class="input-group margin-bottom">
              <input type="hidden" name="page_id" value="<?php echo $pgMod; ?>" />
              <input style="width:200px" class="search-bar form-control" placeholder="Enter username or emailid" value="<?php echo $_GET["search"] ?>" id="appendedInputButton" size="26" name="search" type="text">
              <button class="input-group-addon" type="submit">Go!</button>
            </div>
          </form>
        </div>

        <div class="table-responsive">
          <table  class="table table-bordered">
            <thead>
              <tr>
                <th class="first"><div></div></th>
                <th><a href="#" title="linkname">Class </a></th>
                <th><a href="#" title="linkname">Subject</a></th>
                <th><a href="#" title="Underof">Question</a></th>
                <th><a href="#" title="Underof">Answer</a></th>
               
                
                <th><a href="#" title="status">Status</a></th>
                <th class="last" >Actions</th>
              </tr>
            </thead>
            <tbody>
              <?php
			 
				foreach($aryList as $iList)
				{
					 //echo"==>error<pre>";print_r($iList);exit;
					$aryPgAct["id"]=$iList['userId'];
					
				    $aryPgAct['page_id']=$pgMod;
					//echo"==>error<pre>";print_r($iList);exit;
					//echo"==>error<pre>";print_r($iList['class']);exit;
					
					$question_ary=json_decode($iList["question"],true);
					//$question_ary=json_decode($clist["question"],true);
					//echo"==>error<pre>";print_r($iList);print_r($clist["question"]);exit;
					
					
				 ?>
              <tr id="tr_<?php echo $iList['userId'] ?>">
                <td></td>
                
                
                <td class="text-slash"><?php echo $iList['class']; ?></td>
                <td class="text-slash"><?php echo ucwords($iList['subject']); ?></td>
               
			    <td class="text-slash"><?php echo ucwords($question_ary['question']); ?></td>
               
			    <td class="text-slash"><?php echo ucwords($iList['answer']); ?></td>
               
              
                 <td class="text-slash">
                 
                  <?php if( $iList["status"]==1){ ?>
                  <span class="btn btn-info" >Active</span>
                  <?php }else{ ?>
                  <span  class="btn btn-danger">Inactive</span>
                  <?php } ?>
                 
                 
                 </td>
                 
                 
                 
                  <td class="text-slash">
                    <?php $aryPgAct['action']="edit"; ?>
                          <a href="<?php echo URL_ADMIN_HOME."".$pgMod."&id=".$iList['id']."&action=edit";?>"><button type="button" class="btn btn-info">Edit</button></a>
                        
                         
                         
                    <?php $aryPgAct['action']="delete"; ?>
                         <a href="javascript:;" onclick="del('<?php echo URL_ADMIN_HOME."?page_id=".$pgMod."&id=".$iList['id']."&action=delete";?>')"><button type="button" class="btn btn-danger">Delete</button></a> 
                       
                        
                    </td> 
				
				
                
               
              </tr>
              <?php			
				  }
				?>
            </tbody>
          </table>
        </div>
        <?php echo $resultData["pagestring"]; ?>
        
        <?php
		   }
			else
			{
			  echo '<div class="alert alert-info alert-dismissable">
						<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
						<strong>Notice !</strong> Sorry No record Found. </div>';
			}
		}
		else
		{
			echo '<div class="alert alert-danger alert-dismissable">
						<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
						<strong>error !</strong> '.$db->getErMsg().'. </div>';
		}
	}
			  ?>
    
	
	</div></div></div>
	<?php
}
?>
<!-- / Forms -->