mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-27 03:39:57 +03:00
issue #1710 first implementation of details for each storage category
Needs to be reworked for a better presentation. Expected for Piwigo 14.
This commit is contained in:
parent
740456e34b
commit
cce43df25e
2 changed files with 31 additions and 22 deletions
|
@ -369,49 +369,51 @@ $template->assign('DAY_LABELS', $day_labels);
|
|||
|
||||
$video_format = array('webm','webmv','ogg','ogv','mp4','m4v');
|
||||
$data_storage = array();
|
||||
$file_extensions_of = array();
|
||||
|
||||
//Select files in Image_Table
|
||||
$query = '
|
||||
SELECT
|
||||
COUNT(*) AS ext_counter,
|
||||
SUBSTRING_INDEX(path,".",-1) AS ext,
|
||||
SUM(filesize) AS filesize
|
||||
FROM `'.IMAGES_TABLE.'`
|
||||
GROUP BY ext
|
||||
;';
|
||||
|
||||
$file_extensions = query2array($query, 'ext', 'filesize');
|
||||
$file_extensions = query2array($query, 'ext');
|
||||
|
||||
foreach ($file_extensions as $ext => $size)
|
||||
foreach ($file_extensions as $ext => $ext_details)
|
||||
{
|
||||
$type = null;
|
||||
if (in_array(strtolower($ext), $conf['picture_ext']))
|
||||
{
|
||||
if (isset($data_storage['Photos']))
|
||||
{
|
||||
$data_storage['Photos'] += $size;
|
||||
} else {
|
||||
$data_storage['Photos'] = $size;
|
||||
}
|
||||
$type = 'Photos';
|
||||
}
|
||||
elseif (in_array(strtolower($ext), $video_format))
|
||||
{
|
||||
if (isset($data_storage['Videos']))
|
||||
{
|
||||
$data_storage['Videos'] += $size;
|
||||
} else {
|
||||
$data_storage['Videos'] = $size;
|
||||
}
|
||||
$type = 'Videos';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($data_storage['Other']))
|
||||
{
|
||||
$data_storage['Other'] += $size;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data_storage['Other'] = $size;
|
||||
}
|
||||
$type = 'Other';
|
||||
}
|
||||
|
||||
@$file_extensions_of[$type][strtoupper($ext)] = $ext_details['ext_counter'];
|
||||
@$data_storage[$type] += $ext_details['filesize'];
|
||||
}
|
||||
|
||||
$data_storage_details = array();
|
||||
|
||||
foreach ($file_extensions_of as $type => $extensions)
|
||||
{
|
||||
$details = array();
|
||||
|
||||
foreach ($extensions as $ext => $counter)
|
||||
{
|
||||
$details[] = $counter.'x'.$ext;
|
||||
}
|
||||
$data_storage_details[$type] = implode(', ', $details);
|
||||
}
|
||||
|
||||
//Select files from format table
|
||||
|
@ -450,6 +452,7 @@ foreach ($data_storage as $value)
|
|||
//Pass data to HTML
|
||||
$template->assign('STORAGE_TOTAL',$total_storage);
|
||||
$template->assign('STORAGE_CHART_DATA',$data_storage);
|
||||
$template->assign('STORAGE_DETAILS', json_encode($data_storage_details));
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | sending html code |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
|
|
@ -10,6 +10,7 @@ const str_mb_used = "{'%s MB used'|translate}";
|
|||
const str_gb = "{'%sGB'|translate}".replace(' ', ' ');
|
||||
const str_mb = "{'%sMB'|translate}".replace(' ', ' ');
|
||||
const storage_total = {$STORAGE_TOTAL};
|
||||
const storage_details = {$STORAGE_DETAILS};
|
||||
{literal}
|
||||
jQuery().ready(function(){
|
||||
jQuery('.cluetip').cluetip({
|
||||
|
@ -85,6 +86,11 @@ let str_size = "";
|
|||
str_size_type_string = size > 1000000 ? str_gb : str_mb;
|
||||
size_nb = size > 1000000 ? (size / 1000000).toFixed(2) : (size / 1000).toFixed(0);
|
||||
str_size = " : " + str_size_type_string.replace("%s", size_nb);
|
||||
|
||||
if (typeof storage_details.{$type} !== 'undefined') {
|
||||
// str_size += " (" + storage_details.{$type} + ")";
|
||||
}
|
||||
|
||||
$("#storage-{$type}").html("<b></b>" + str_size);
|
||||
$("#storage-{$type} b").html("{$type|translate}");
|
||||
{/foreach}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue