forked from matteveland/inventory_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
media.php
93 lines (85 loc) · 3.07 KB
/
media.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
<?php
/**
* media.php
*
* @package default
*/
$page_title = 'All Image';
require_once 'includes/load.php';
// Checkin What level user has permission to view this page
page_require_level(2);
?>
<?php $media_files = find_all('media');?>
<?php
if (isset($_POST['submit'])) {
$photo = new Media();
$photo->upload($_FILES['file_upload']);
if ($photo->process_media()) {
$session->msg('s', 'photo has been uploaded.');
redirect('media.php');
} else {
$session->msg('d', join($photo->errors));
redirect('media.php');
}
}
?>
<?php include_once 'layouts/header.php'; ?>
<div class="row">
<div class="col-md-6">
<?php echo display_msg($msg); ?>
</div>
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<span class="glyphicon glyphicon-camera"></span>
<span>All Photos</span>
<div class="pull-right">
<form class="form-inline" action="media.php" method="POST" enctype="multipart/form-data">
<div class="form-group">
<div class="input-group">
<span class="input-group-btn">
<input type="file" name="file_upload" multiple="multiple" class="btn btn-primary btn-file"/>
</span>
<button type="submit" name="submit" class="btn btn-default">Upload</button>
</div>
</div>
</form>
</div>
</div>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th class="text-center" style="width: 50px;">#</th>
<th class="text-center">Photo</th>
<th class="text-center">Photo Name</th>
<th class="text-center" style="width: 20%;">Photo Type</th>
<th class="text-center" style="width: 50px;">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($media_files as $media_file): ?>
<tr class="list-inline">
<td class="text-center"><?php echo count_id();?></td>
<td class="text-center">
<img src="uploads/products/<?php echo $media_file['file_name'];?>" class="img-thumbnail" />
</td>
<td class="text-center">
<?php echo $media_file['file_name'];?>
</td>
<td class="text-center">
<?php echo $media_file['file_type'];?>
</td>
<td class="text-center">
<a href="delete_media.php?id=<?php echo (int) $media_file['id'];?>" onClick="return confirm('Are you sure you want to delete?')" class="btn btn-danger btn-xs" title="Edit">
<span class="glyphicon glyphicon-trash"></span>
</a>
</td>
</tr>
<?php endforeach;?>
</tbody>
</div>
</div>
</div>
</div>
<?php include_once 'layouts/footer.php'; ?>