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) {
|
$twig->addFilter(new \Twig_SimpleFilter('escapeDoubleQuote', function ($value) {
|
||||||
return str_replace('"', '\"', $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->setTitles((array) igorw\get_in($data, ['title'], []));
|
||||||
$record->setCaption((array) igorw\get_in($data, ['caption'], []));
|
$record->setCaption((array) igorw\get_in($data, ['caption'], []));
|
||||||
$record->setPrivateCaption((array) igorw\get_in($data, ['private_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->setSubdefs((array) igorw\get_in($data, ['subdefs'], []));
|
||||||
$record->setFlags((array) igorw\get_in($data, ['flags'], []));
|
$record->setFlags((array) igorw\get_in($data, ['flags'], []));
|
||||||
$record->setHighlight((array) $highlight);
|
$record->setHighlight((array) $highlight);
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
{% block td_duration %}
|
{% block td_duration %}
|
||||||
{% if record.exif[constant('media_subdef::TC_DATA_DURATION')] is defined %}
|
{% if record.exif[constant('media_subdef::TC_DATA_DURATION')] is defined %}
|
||||||
<dt>{{ 'Duree' | trans }} :
|
<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 %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block td_framerate %}
|
{% block td_framerate %}
|
||||||
|
|||||||
@@ -33,12 +33,12 @@
|
|||||||
<div class="thumb captionTips " tooltipsrc="{{ tooltipsrc }}"
|
<div class="thumb captionTips " tooltipsrc="{{ tooltipsrc }}"
|
||||||
style="height:{{ images_size }}px; z-index:90;">
|
style="height:{{ images_size }}px; z-index:90;">
|
||||||
<div class="doc_infos">
|
<div class="doc_infos">
|
||||||
{% if doctype_display %}
|
|
||||||
{{ record_doctype_icon(record) }}
|
|
||||||
{% endif %}
|
|
||||||
<span class="duration">
|
<span class="duration">
|
||||||
{{ record.get_formated_duration }}
|
{{ record.get_formated_duration }}
|
||||||
</span>
|
</span>
|
||||||
|
{% if doctype_display %}
|
||||||
|
{{ record_doctype_icon(record) }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="{% if rollover_gif %}rollovable{% endif %}">
|
<div class="{% if rollover_gif %}rollovable{% endif %}">
|
||||||
{% set extraclass = rollover_gif ? 'rollover-gif-out' : '' %}
|
{% 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 %}
|
{% 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;">
|
style="height:{{ settings.images_size }}px; z-index:90;">
|
||||||
<div class="doc_infos">
|
<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' %}
|
{% if settings.doctype_display == '1' %}
|
||||||
{{ record_doctype_icon(record) }}
|
{{ record_doctype_icon(record) }}
|
||||||
{% endif %}
|
{% 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>
|
</div>
|
||||||
{% set rollover = record.subdefs.thumbnailgif is defined %}
|
{% set rollover = record.subdefs.thumbnailgif is defined %}
|
||||||
{% set extraclass = '' %}
|
{% set extraclass = '' %}
|
||||||
|
|||||||
Reference in New Issue
Block a user