rwincewicz
13 years ago
18 changed files with 407 additions and 105 deletions
@ -0,0 +1,48 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* Convert bytes to human readable format |
||||
* |
||||
* @param integer bytes Size in bytes to convert |
||||
* @return string |
||||
*/ |
||||
function islandora_convert_bytes_to_human_readable($bytes, $precision = 2) |
||||
{ |
||||
$kilobyte = 1024; |
||||
$megabyte = $kilobyte * 1024; |
||||
$gigabyte = $megabyte * 1024; |
||||
$terabyte = $gigabyte * 1024; |
||||
|
||||
if (($bytes >= 0) && ($bytes < $kilobyte)) { |
||||
return $bytes . ' B'; |
||||
|
||||
} elseif (($bytes >= $kilobyte) && ($bytes < $megabyte)) { |
||||
return round($bytes / $kilobyte, $precision) . ' KB'; |
||||
|
||||
} elseif (($bytes >= $megabyte) && ($bytes < $gigabyte)) { |
||||
return round($bytes / $megabyte, $precision) . ' MB'; |
||||
|
||||
} elseif (($bytes >= $gigabyte) && ($bytes < $terabyte)) { |
||||
return round($bytes / $gigabyte, $precision) . ' GB'; |
||||
|
||||
} elseif ($bytes >= $terabyte) { |
||||
return round($bytes / $terabyte, $precision) . ' TB'; |
||||
} else { |
||||
return $bytes . ' B'; |
||||
} |
||||
} |
||||
|
||||
function islandora_control_group_to_human_readable($control_group) { |
||||
switch($control_group) { |
||||
case 'M': |
||||
return '<b>M</b>anaged'; |
||||
case 'X': |
||||
return 'Inline <b>X</b>ML'; |
||||
case 'R': |
||||
return '<b>R</b>edirect'; |
||||
case 'E': |
||||
return '<b>E</b>xternally Referenced'; |
||||
default: |
||||
return $control_group; |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
<?php |
||||
|
||||
/* |
||||
* islandora-basic-collection.tpl.php |
||||
* |
||||
* |
||||
* |
||||
* This file is part of Islandora. |
||||
* |
||||
* This program is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU General Public License as published by |
||||
* the Free Software Foundation, either version 3 of the License, or |
||||
* (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with the program. If not, see <http ://www.gnu.org/licenses/>. |
||||
*/ |
||||
?> |
||||
<?php drupal_set_title('grid_view'); ?> |
||||
|
||||
<div class="islandora-basic-collection-wrapper"> |
||||
<div class="islandora-basic-collection clearfix"> |
||||
<?php print($variables['pager']); ?> |
||||
<?php foreach($associated_objects_array as $key => $value): ?> |
||||
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>">
|
||||
<dt class="islandora-basic-collection-thumb"><?php print $value['thumb_link']; ?></dt>
|
||||
<dd class="islandora-basic-collection-caption"><?php print $value['title_link']; ?></dd>
|
||||
</dl> |
||||
<?php endforeach; ?> |
||||
<?php print($variables['pager']); ?> |
||||
</div> |
||||
</div> |
Loading…
Reference in new issue