-
Notifications
You must be signed in to change notification settings - Fork 0
/
edit_post.php
123 lines (95 loc) · 3.87 KB
/
edit_post.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php include('header_dashboard.php'); ?>
<?php include('session.php'); ?>
<?php $get_id = $_GET['id']; ?>
<?php
$get_id1 = $_POST['id'];
?>
<body>
<?php include('navbar_teacher.php'); ?>
<div class="container-fluid">
<div class="row-fluid">
<?php include('annoucement_link.php'); ?>
<div class="span9" id="content">
<div class="row-fluid">
<!-- breadcrumb -->
<?php $class_query = mysqli_query($conn,"select * from teacher_class
LEFT JOIN class ON class.class_id = teacher_class.class_id
LEFT JOIN subject ON subject.subject_id = teacher_class.subject_id
where teacher_class_id = '$get_id'")or die(mysqli_error());
$class_row = mysqli_fetch_array($class_query);
?>
<ul class="breadcrumb">
<li><a href="#"><?php echo $class_row['class_name']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><?php echo $class_row['subject_code']; ?></a> <span class="divider">/</span></li>
<li><a href="#"><b>Announcements</b></a></li>
</ul>
<!-- end breadcrumb -->
<!-- block -->
<div id="block_bg" class="block">
<div class="navbar navbar-inner block-header">
<div id="" class="muted pull-left"></div>
</div>
<div class="block-content collapse in">
<div class="span12">
<a href="announcements.php<?php echo '?id='.$get_id; ?>"><i class="icon-arrow-left icon-large"></i> Back</a>
<br>
<br>
<form method="post">
<?php
$query_announcement = mysqli_query($conn,"select * from teacher_class_announcements
where teacher_id = '$session_id' and teacher_class_announcements_id = '$get_id1' and teacher_class_id = '$get_id' order by date DESC
")or die(mysqli_error());
$row = mysqli_fetch_array($query_announcement);
$id = $row['teacher_class_announcements_id'];
?>
<input type="hidden" name="id" value="<?php echo $id; ?>">
<textarea name="content" id="ckeditor_full">
<?php echo $row['content']; ?>
</textarea>
<br>
<button name="post" class="btn btn-info"><i class="icon-check icon-large"></i> Post</button>
</form>
</div>
<?php
if (isset($_POST['post'])){
$content = $_POST['content'];
$id = $_POST['id'];
mysqli_query($conn,"update teacher_class_announcements set content = '$content' where teacher_class_announcements_id = '$id' ")or die(mysqli_error());
?>
<script>
window.location = 'announcements.php<?php echo '?id='.$get_id; ?>';
</script>
<?php
}
?>
</div>
</div>
<!-- /block -->
</div>
</div>
<script type="text/javascript">
$(document).ready( function() {
$('.remove').click( function() {
var id = $(this).attr("id");
$.ajax({
type: "POST",
url: "remove_announcements.php",
data: ({id: id}),
cache: false,
success: function(html){
$("#del"+id).fadeOut('slow', function(){ $(this).remove();});
$('#'+id).modal('hide');
$.jGrowl("Your Post is Successfully Deleted", { header: 'Data Delete' });
}
});
return false;
});
});
</script>
</div>
</div>
<?php include('footer.php'); ?>
</div>
<?php include('script.php'); ?>
</body>
</html>