| Current Path : /home/bolconlineco/www/student/ |
| Current File : /home/bolconlineco/www/student/discussion_forum.php |
<?php
ob_start();
session_start();
?>
<?php include('header.php');?>
<script src="//cdn.datatables.net/1.10.9/js/jquery.dataTables.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="//cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css">
<?php
if(!isset($_SESSION['studentname']) || $_SESSION['studentrole'] != 4)
{
header("location:../index.php");
exit();
}
?>
<?php
$quid="select courseid from assigncourse where rollno='$rollno'";
$ruid=mysql_query($quid) or die(mysql_error());
$fetchess=mysql_fetch_array($ruid);
?>
<script>
$(document).ready(function() {
$('.uppers h4').click(function() {
$(this).next('.answer').slideToggle(500);
$(this).toggleClass('close');
});
});
</script>
<div class="row">
<div class="col-md-12">
<!-- BEGIN EXAMPLE TABLE PORTLET-->
<div class="portlet box blue">
<div class="portlet-title clearfix" style="overflow: hidden;">
<div class="caption"> <i class="fa fa-globe"></i>Forum <a href="<?php $_SERVER['PHP_SELF'];?>?y" style="float:right;" >Add Topic</a></div>
</div>
<div class="portlet-body">
<div id="content">
<?php
if(isset($_GET['y']))
{
?>
<form action="" method="post" class="form-horizontal">
<h2>Add Topic</h2>
<div class="form-group clearfix">
<label for="title" class="col-sm-2 control-label">Title : </label>
<div class="col-sm-6">
<input type="text" name="topic" style="width:500px;" class="form-control"/>
</div>
</div>
<div class="form-group clearfix">
<label for="description" class="col-sm-2 control-label">Description : </label>
<div class="col-sm-6">
<textarea class="ckeditor form-control" name="desc" id="description" rows="12"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-6 col-sm-offset-2">
<input class="add2 btn btn-success" type="submit" name="add" value="Add " />
<input type="submit" name="cancel" value="cancel" class="add2 btn btn-success" onClick="javascript:window.location.href='News.php';" />
</div>
</div>
</form>
<?php
}
?>
<table class="tablestyle table table-striped table-bordered table-hover" id="sample_2">
<thead>
<tr>
<td>Topic</td>
<td>Date</td>
<td>View</td>
</tr>
</thead>
<tbody>
<t>
<?php
$query = "select * from tbl_forum where courseid=".$fetchess['courseid'];
$result = mysql_query($query) or die(mysql_error());
while($row=mysql_fetch_array($result))
{
list($year,$month,$day)=explode('-',$row['topic_date']);
?>
<tr>
<td><h4><?php echo $row['topic_name']; ?></h4></td>
<div class="answer">
<p><?php echo $row['topic_description']; ?></p>
</div>
</td>
<td><?php echo $day.'/'.$month.'/'.$year; ?></td>
<td><a href="forum.php?id=<?php echo $row['id']; ?>">Topic Details</a></td>
</tr>
<?php
}
?>
</tbody>
</table>
<script>
$(document).ready(function(){
$('#mytable2').dataTable({bFilter: false, bInfo: false, "bLengthChange": false});
});
</script>
</div>
</div><!-- end row -->
<?php
if(isset($_POST['add']))
{
$topic=strip_tags(mysql_real_escape_string($_POST['topic']));
$desc=strip_tags(mysql_real_escape_string($_POST['desc']));
$date=date('Y-m-d');
$query="insert into tbl_forum values ('','".$fetchess['courseid']."','$topic','$desc','$fullname','$date',1)";
mysql_query($query) or die(mysql_error());
header("location:discussion_forum.php");
exit();
}
?>
</div> <!-- end content -->
</div>
</div>
</div>
</div>
</div>
</div><!-- end wrapper -->
<script>
CKEDITOR.replace( 'description',
{
width : '800px',
filebrowserBrowseUrl : '<?php echo $url;?>combine/cms/ckfinder/ckfinder.html',
filebrowserImageBrowseUrl : '<?php echo $url;?>combine/cms/ckfinder/ckfinder.html?Type=Images',
filebrowserFlashBrowseUrl : '<?php echo $url;?>combine/cms/ckfinder/ckfinder.html?Type=Flash',
filebrowserUploadUrl : '<?php echo $url;?>combine/cms/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl : '<?php echo $url;?>combine/cms/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl : '<?php echo $url;?>combine/cms/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
});
</script>
<?php include('../includes/footer.php');?>