$this->viewData->searches = $this->_processSearches();
$this->viewData->outlinks = $this->_processOutgoingLinks();
$this->viewData->countries = $this->_processCountries();
+ $this->viewData->multimedia = $this->_processMultimedia();
$this->viewData->shareDetails = $this->_processShareDetails();
//=== MAIN PERIOD STATISTICS
return collect($this->_eventsByPage['link']['subtable'] ?? [])->sortByDesc('nb_events');
}
+ protected function _processMultimedia()
+ {
+ $types = ['slideshow' => ['show'], 'video' => ['play', 'show']];
+
+ $typesSubtable = [];
+ foreach ($this->apiCall('Events.getCategory') as $period) {
+ foreach ($period as $category) {
+ $typesSubtable[$category['label']] = $category['idsubdatatable'];
+ }
+ }
+
+
+ $res = [];
+ foreach ($types as $type => $actions) {
+ foreach ($actions as $action) {
+ $data = $this->apiCall('Events.getNameFromCategoryId', ['idSubtable' => $typesSubtable[$type], 'segment' => 'eventAction==' . $action]);
+ foreach ($data as $day => $events) {
+ foreach ($events as $event) {
+ $label = $event['label'];
+ $e = explode('|:|', $label, 2);
+ $page = '';
+ if (count($e) == 2) {
+ $page = $e[1];
+ }
+ if (!isset($res[$label])) {
+ $res[$label] = ['type' => $type, 'nb' => 0, 'pages' => []];
+ }
+ $res[$label]['nb'] += $event['nb_events'];
+ if ($page && !in_array($page, $res[$label]['pages'])) {
+ $res[$label]['pages'][] = $page;
+ sort($res[$label]['pages']);
+ }
+ }
+ }
+ }
+
+ }
+
+ return collect($res)->sortByDesc('nb');
+ }
+
protected function _processCountries()
{
//=== COUNTRIES OF ORIGIN
{{-- Summary of totals --}}
@if($period_details->isNotEmpty())
@foreach ($table_map['summary'] as $summary_key => $summary_heading)
- @if($summary_key === 'formatted_date' || $period_details->sum($summary_key)===0)
+ @if($summary_key === 'formatted_date' || !$period_details->sum($summary_key))
@continue
@endif
<tr>
</tr>
@endforeach
- <tr>
- <td>{{ __('Recherches') }}</td>
- <td>{{ $formatter->format($searches->sum()) }}</td>
- </tr>
+ @if($searches->sum()>0)
+ <tr>
+ <td>{{ __('Recherches') }}</td>
+ <td>{{ $formatter->format($searches->sum()) }}</td>
+ </tr>
+ @endif
@endif
</table>
<a id="chart"></a>
</div>
@endif
+ @if($multimedia->isNotEmpty())
+ @php
+ $icons=['slideshow'=>'las la-image','video'=>'las la-video'];
+ @endphp
+ <div>
+ <h3>{{ __('Contenus multimédia') }}</h3>
+
+ <table class="{!! $tableClasses !!}">
+ <thead>
+ <tr>
+ <th style="width: 55%;">{{ __('Contenu') }}</th>
+ <th style="width: 20%;">{{ __('Page') }}</th>
+ <th style="width: 15%;" class="sorttable_sorted_reverse">{{ __('Vues') }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ @foreach($multimedia as $label=>$media)
+ <tr>
+ <td class="whitespace-nowrap" data-sort-value="{{$label }}">
+ <i class="{{$icons[$media['type']]}}"></i> {{$label }}
+ </td>
+ <td data-sort-value="{{ $media['pages'][0] ?? 0}}">{{implode(', ',$media['pages']) }}</td>
+ <td>{{ $formatter->format($media['nb']) }}</td>
+ </tr>
+ @endforeach
+ </tbody>
+ </table>
+ </div>
+ @endif
+
</div>