Skip to content

Commit

Permalink
Display files & icons
Browse files Browse the repository at this point in the history
  • Loading branch information
tsawler committed Apr 6, 2015
1 parent 98a9584 commit 51b7473
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
35 changes: 30 additions & 5 deletions src/controllers/ItemsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,44 @@ public function getFiles()

$file_info = [];

$icon_array = [
"pdf" => "fa-file-pdf-o",
"docx" => "fa-file-word-o",
"docx" => "fa-file-word-o",
"xls" => "fa-file-excel-o",
"xls" => "fa-file-excel-o",
"zip" => 'fa-file-archive-o',
"gif" => 'fa-file-image-o',
"jpg" => 'fa-file-image-o',
"jpeg" => 'fa-file-image-o',
"png" => 'fa-file-image-o',
"ppt" => 'fa-file-powerpoint-o',
"pptx" => 'fa-file-powerpoint-o',
];

foreach ($files as $file)
{
$file_name = $file;
$file_size = 1;
$extension = strtolower(File::extension($file_name));

if (array_key_exists($extension, $icon_array))
{
$icon = $icon_array[$extension];
} else
{
$icon = "fa-file";
}

$file_created = filemtime($file);
$file_type = '';
$file_info[] = [
'name' => $file_name,
'size' => $file_size,
'created' => $file_created,
'type' => $file_type,
'icon' => 'fa-file-archive-o'
'name' => $file_name,
'size' => $file_size,
'created' => $file_created,
'type' => $file_type,
'extension' => $extension,
'icon' => $icon,
];
}

Expand Down
4 changes: 2 additions & 2 deletions src/views/files.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class="btn btn-default btn-xs">

<div class="col-sm-6 col-md-2 img-row">

<div class="thumbnail thumbnail-img text-center" data-id="{{ basename($file['name']) }}" id="img_thumbnail_{{ $key }}">
<i class="fa <?= $file['icon'] ?> fa-5x"></i>
<div class="thumbnail thumbnail-img text-center" style="border: none;" data-id="{{ basename($file['name']) }}" id="img_thumbnail_{{ $key }}">
<i class="fa <?= $file['icon']; ?> fa-5x"></i>
</div>

<div class="caption text-center">
Expand Down

0 comments on commit 51b7473

Please sign in to comment.