mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 10:23:17 +00:00
PORT PHRAS-854 to 4.1
This commit is contained in:
@@ -143,6 +143,25 @@ class TwigServiceProvider implements ServiceProviderInterface
|
||||
$twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) {
|
||||
return str_replace('"', '\"', $value);
|
||||
}));
|
||||
|
||||
$twig->addFilter(new \Twig_SimpleFilter('formatDuration',
|
||||
function ($secondsInDecimals) {
|
||||
$time = [];
|
||||
$hours = floor($secondsInDecimals / 3600);
|
||||
$secondsInDecimals -= $hours * 3600;
|
||||
$minutes = floor($secondsInDecimals / 60);
|
||||
$secondsInDecimals -= $minutes * 60;
|
||||
$seconds = intVal($secondsInDecimals % 60, 10);
|
||||
if ($hours > 0) {
|
||||
array_push($time, (strlen($hours) < 2) ? "0{$hours}" : $hours);
|
||||
}
|
||||
array_push($time, (strlen($minutes) < 2) ? "0{$minutes}" : $minutes);
|
||||
array_push($time, (strlen($seconds) < 2) ? "0{$seconds}" : $seconds);
|
||||
$formattedTime = implode(':', $time);
|
||||
|
||||
return $formattedTime;
|
||||
}
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ class ElasticsearchRecordHydrator
|
||||
$record->setTitles((array) igorw\get_in($data, ['title'], []));
|
||||
$record->setCaption((array) igorw\get_in($data, ['caption'], []));
|
||||
$record->setPrivateCaption((array) igorw\get_in($data, ['private_caption'], []));
|
||||
$record->setExif((array) igorw\get_in($data, ['exif'], []));
|
||||
$record->setExif((array)igorw\get_in($data, ['metadata_tags'], []));
|
||||
$record->setSubdefs((array) igorw\get_in($data, ['subdefs'], []));
|
||||
$record->setFlags((array) igorw\get_in($data, ['flags'], []));
|
||||
$record->setHighlight((array) $highlight);
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
{% block td_duration %}
|
||||
{% if record.exif[constant('media_subdef::TC_DATA_DURATION')] is defined %}
|
||||
<dt>{{ 'Duree' | trans }} :
|
||||
<dd>{{ record.exif[constant('media_subdef::TC_DATA_DURATION')] }}</dd>
|
||||
<dd>{{ record.exif[constant('media_subdef::TC_DATA_DURATION')]|formatDuration }}</dd>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block td_framerate %}
|
||||
|
||||
@@ -33,12 +33,12 @@
|
||||
<div class="thumb captionTips " tooltipsrc="{{ tooltipsrc }}"
|
||||
style="height:{{ images_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
{% if doctype_display %}
|
||||
{{ record_doctype_icon(record) }}
|
||||
{% endif %}
|
||||
<span class="duration">
|
||||
{{ record.get_formated_duration }}
|
||||
</span>
|
||||
{% if doctype_display %}
|
||||
{{ record_doctype_icon(record) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="{% if rollover_gif %}rollovable{% endif %}">
|
||||
{% set extraclass = rollover_gif ? 'rollover-gif-out' : '' %}
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
{% if settings.rollover_thumbnail == 'preview' %}tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.databoxId, 'record_id' : record.recordId }) }}"{% endif %}
|
||||
style="height:{{ settings.images_size }}px; z-index:90;">
|
||||
<div class="doc_infos">
|
||||
<span class="duration">
|
||||
{% if record.type == 'video' and attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION')) is defined %}
|
||||
{{ attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION'))|formatDuration }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% if settings.doctype_display == '1' %}
|
||||
{{ record_doctype_icon(record) }}
|
||||
{% endif %}
|
||||
<span class="duration">
|
||||
{% if record.type == 'video' and attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION')) is defined %}
|
||||
{{ attribute(record.exif, constant('\\media_subdef::TC_DATA_DURATION')) }}
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
{% set rollover = record.subdefs.thumbnailgif is defined %}
|
||||
{% set extraclass = '' %}
|
||||
|
||||
Reference in New Issue
Block a user