-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_archive.php
98 lines (98 loc) · 4.14 KB
/
view_archive.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
<?php
if(isset($_GET['id']) && $_GET['id'] > 0){
$qry = $conn->query("SELECT a.* FROM `archive_list` a where a.id = '{$_GET['id']}'");
if($qry->num_rows){
foreach($qry->fetch_array() as $k => $v){
if(!is_numeric($k))
$$k = $v;
}
}
$submitted = "N/A";
if(isset($student_id)){
$student = $conn->query("SELECT * FROM student_list where id = '{$student_id}'");
if($student->num_rows > 0){
$res = $student->fetch_array();
$submitted = $res['email'];
}
}
}
?>
<style>
#document_field{
min-height:80vh
}
</style>
<div class="content py-4">
<div class="col-12">
<div class="card card-outline card-primary shadow rounded-0">
<div class="card-header">
<h3 class="card-title">
Archive - <?= isset($archive_code) ? $archive_code : "" ?>
</h3>
</div>
<div class="card-body rounded-0">
<div class="container-fluid">
<h2><b><?= isset($title) ? $title : "" ?></b></h2>
<small class="text-muted">Submitted by <b class="text-info"><?= $submitted ?></b> on <?= date("F d, Y h:i A",strtotime($date_created)) ?></small>
<?php if(isset($student_id) && $_settings->userdata('login_type') == "2" && $student_id == $_settings->userdata('id')): ?>
<div class="form-group">
<a href="./?page=submit-archive&id=<?= isset($id) ? $id : "" ?>" class="btn btn-flat btn-default bg-navy btn-sm"><i class="fa fa-edit"></i> Edit</a>
<button type="button" data-id = "<?= isset($id) ? $id : "" ?>" class="btn btn-flat btn-danger btn-sm delete-data"><i class="fa fa-trash"></i> Delete</button>
</div>
<?php endif; ?>
<hr>
<center>
<img src="<?= validate_image(isset($banner_path) ? $banner_path : "") ?>" alt="Banner Image" id="banner-img" class="img-fluid border bg-gradient-dark">
</center>
<fieldset>
<legend class="text-navy">Project Year:</legend>
<div class="pl-4"><large><?= isset($year) ? $year : "----" ?></large></div>
</fieldset>
<fieldset>
<legend class="text-navy">Abstract:</legend>
<div class="pl-4"><large><?= isset($abstract) ? html_entity_decode($abstract) : "" ?></large></div>
</fieldset>
<fieldset>
<legend class="text-navy">Members:</legend>
<div class="pl-4"><large><?= isset($members) ? html_entity_decode($members) : "" ?></large></div>
</fieldset>
<fieldset>
<legend class="text-navy">Project Document:</legend>
<div class="pl-4">
<iframe src="<?= isset($document_path) ? base_url.$document_path : "" ?>" frameborder="0" id="document_field" class="text-center w-100">Loading Document ...</iframe>
</div>
</fieldset>
</div>
</div>
</div>
</div>
</div>
<script>
$(function(){
$('.delete-data').click(function(){
_conf("Are you sure to delete <b>Archive-<?= isset($archive_code) ? $archive_code : "" ?></b>","delete_archive")
})
})
function delete_archive(){
start_loader();
$.ajax({
url:_base_url_+"classes/Master.php?f=delete_archive",
method:"POST",
data:{id: "<?= isset($id) ? $id : "" ?>"},
dataType:"json",
error:err=>{
console.log(err)
alert_toast("An error occured.",'error');
end_loader();
},
success:function(resp){
if(typeof resp== 'object' && resp.status == 'success'){
location.replace("./");
}else{
alert_toast("An error occured.",'error');
end_loader();
}
}
})
}
</script>