Preview: question.php
Size: 8.76 KB
/home/jambtst2015/public_html/giraffeng.com/admin/question.php
<?php include("includes/head.php"); ?>
<?php include("includes/header.php"); ?>
<?php
if($_REQUEST['delete']=="del" && $_REQUEST['delete_id']!='')
{
mysql_query("delete from exam_question_answers_reasons where id='".$_REQUEST['delete_id']."'");
//mysql_query("delete from sat_users_history where user_id='".$_REQUEST['delete_id']."'");
$delmsg="Details deleted successfully";
header('location:question.php?success=2');
exit();
}
?>
<script type="text/javascript" src="http://latex.codecogs.com/integration/ckeditor/ckeditor.js">
<script type="text/javascript" language="javascript">
function open_src()
{
if(document.getElementById("div_src").style.display=='none')
{
//document.getElementById("div_src").style.display='block';
$("#div_src").show("slow");
}
else
{
//document.getElementById("div_src").style.display='none';
$("#div_src").hide("slow");
}
}
$(document).ready(function(){
setTimeout(function(){
$(".mydiv").fadeOut("slow", function () {
$(".mydiv").remove("slow");
});
}, 4000);
});
</script>
<!--https://www.codecogs.com/latex/quick-install.php-->
<div class="container_bottom_section">
<?php if($msg!=''){ ?>
<p class="mydiv" style="color:#F00; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $msg; ?></p>
<?php } ?>
<?php if($delmsg!=''){ ?>
<p class="mydiv" style="color:#F00; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;"><?php echo $delmsg; ?></p>
<?php } ?>
<?php if($_REQUEST['success']=='2'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;">Question Deleted Successfully</p>
<?php } ?>
<?php if($_REQUEST['success']=='3'){ ?>
<p class="mydiv" style="color:#090; float:left; font-family:Verdana, Geneva, sans-serif; font-size:13px; text-align:left;">Question Updated Successfully</p>
<?php } ?>
<!--<a href="javascript:open_src();" class="require" style="margin-right:5px; margin-bottom:5px;"><i class="fa fa-search"></i> Search</a>-->
<?php if($level==1){ ?>
<?php /*?><a href="users_export_xls.php" class="require" style="margin-right:5px; margin-bottom:5px;">Export</a><?php */?>
<a href="userform.php" class="require org" style="margin-right:5px; margin-bottom:5px;"><i class="fa fa-plus"></i> Add User</a>
<?php } ?>
<div class="clear"></div>
<?php if(empty($_REQUEST['submit2'])){$_REQUEST['submit2']='';} ?>
<div class="search-box" style="padding:5px; <?php if($_REQUEST['submit2']=='') { ?>display:none;<?php } ?> border:1px solid #C4C4C4; margin-bottom:10px;" id="div_src">
<div class="require_add">
<h3 style="font-family:Arial, Helvetica, sans-serif; font-size:18px; float:left; color:#2597C9; padding-bottom:5px;"><i class="fa fa-search"></i> Search By</h3>
<div class="clear"></div>
</div>
<form name="myfrm" action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_search">
<tr>
<td colspan="8" height="10"></td>
</tr>
<tr>
<td width="10%" height="25" valign="top" class="require_table_search">Pin Type:</td>
<td colspan="4" align="left" valign="top">
<input type="text" name="pin_type" class="textfield require_field" value="<?php echo $_REQUEST['pin_type']; ?>" />
</td>
<td width="3%"> </td>
</tr>
<tr>
<td colspan="12">
<span style="float:right;margin: 0px 22px 0px 0px;">
<input name="submit2" type="submit" value="Search" class="require sm" style="margin-top:0px !important;" />
<a href="question.php" style="text-decoration:none;" class="require org"> Show All
</a>
</span>
</td>
</tr>
</table>
</form>
</div>
<table width="1100" border="1" cellspacing="0" cellpadding="0" bordercolor="#616161" style="border-collapse:collapse;" class="list-table">
<tr>
<td colspan="7"><a href="question_bulk_add.php">Add Question By Bulk Upload</a></td> <td colspan="1"><a href="question_single_add.php">Add Single Question</a></td>
</tr>
<tr>
<td width="70" class="head_text">ID</td>
<td width="140" class="head_text">Question</td>
<td width="101" class="head_text">Subject</td>
<td width="101" class="head_text">Paper</td>
<td width="101" class="head_text">Topic</td>
<td width="101" class="head_text">Sub Topic</td>
<td width="62" class="head_text text-center">Action</td>
</tr>
<?php
if(empty($_REQUEST['order']))
{
$_REQUEST['order']='';
}
$qry_contact = "select * from exam_question_answers_reasons";
if($_REQUEST['pin_type']!='')
{
$qry_contact .= " where pin_type like '%".trim($_REQUEST['pin_type']," ")."%'";
}
$qry_contact .= " order by id ".$oredr; //sorting by id //
$_SESSION['sqlUser']='';
$sel_events=mysql_query($qry_contact);
/////////////////////////////////////Start pagination/////////////////////////////////////////////////
if(empty($_REQUEST['page'])) { $_REQUEST['page']=''; }
$page=$_REQUEST['page'];
if($page=="")
{
$page = 1;
}
if($_REQUEST['submit2']!='' && $page!=1)
{
$page = $page;
}
$max_results = 50;
$prev = ($page - 1);
$next = ($page + 1);
$from = (($page * $max_results) - $max_results);
$total_results = mysql_num_rows($sel_events);
$total_pages = ceil($total_results / $max_results);
$pagination = '';
if($page > 1)
{
$pagination .= "<a href=\"question.php?page=$prev\"more_link_pagination_prev\">Previous</a>";
$pagination.=" ";
}
for($i = 1; $i <=$total_pages; $i++)
{
if(($page) == $i)
{
$pagination .= $i;
$pagination.=' ';
}
else
{
$pagination .= "<a href=\"question.php?page=$i\"more_link_pagination\">$i</a>";
$pagination.=' ';
}
}
if($page < $total_pages)
{
$pagination .= "<a href=\"question.php?page=$next\"more_link_pagination_prev\">Next</a>";
$pagination.=" ";
}
$qry_contact.=" limit $from,$max_results";
$qry_contact; //Limit print//
$result=mysql_query($qry_contact);
//print_r($qry_contact); //Display Result//
////////////////////////////////End pagination////////////////////////////////////
if(mysql_num_rows($result)>0)
{
$inc=1;
while($row_contact_details=mysql_fetch_array($result))
{
$id = $row_contact_details['id'];
$question = $row_contact_details['question'];
$status = $row_contact_details['status'];
if($subject_id = $row_contact_details['subject_id'])
{
$res1 = mysql_query("select * from exam_subject_master where id=".$subject_id."");
$ress1 = mysql_fetch_array($res1);
//print_r($ress);
$subject_name = $ress1['subject'];
}
if($topic_id = $row_contact_details['topic_id'])
{
$res2 = mysql_query("select * from exam_topic where id=".$topic_id."");
$ress2 = mysql_fetch_array($res2);
//print_r($ress);
$topic_name = $ress2['name'];
}
if($sub_topic_id = $row_contact_details['sub_topic_id'])
{
$res3 = mysql_query("select * from exam_sub_topic where id=".$sub_topic_id."");
$ress3 = mysql_fetch_array($res3);
//print_r($ress);
$sub_topic_name = $ress3['name'];
}
if($paper_id = $row_contact_details['paper_id'])
{
$res3 = mysql_query("select * from exam_paper where id=".$paper_id."");
$ress3 = mysql_fetch_array($res3);
//print_r($ress);
$paper_name = $ress3['paper_name'];
}
/////////////////////////////////////////////////////
?>
<tr>
<td class="head_text2"><?php echo $id; ?></td>
<td class="head_text2"><?php echo $question; ?></td>
<td class="head_text2"><?php echo $subject_name; ?></td>
<td class="head_text2"><?php echo $paper_name; ?></td>
<td class="head_text2"><?php echo $topic_name; ?></td>
<td class="head_text2"><?php echo $sub_topic_name; ?></td>
<td class="head_text2 text-center">
<a href="question_edit.php?id=<?php echo $row_contact_details['id'];?>"><img src="images/edit.png" alt="Edit" title="Edit" userclass="Edit" /></a>
<a href="question.php?delete=del&delete_id=<?php echo $row_contact_details['id'];?>" onclick="return confirm('Are you sure you want to delete this?');" style="text-decoration:none;"><img src="images/delete.png" alt="Delete" title="Delete" /></a>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="7" class="tbl-footer pagination-nw" style="background-color:;"><?php echo $pagination; ?></td>
</tr>
<?php } else {?>
<tr>
<td colspan="7" class="head_text" style="background-color:#B2CEFC;">No data found</td>
</tr>
<?php } ?>
</table>
<div class="clear"></div>
</div>
<?php include("includes/footer.php"); ?>
Directory Contents
Dirs: 17 × Files: 180