$this->viewData->countries = $this->_processCountries();
$this->viewData->multimedia = $this->_processMultimedia();
$this->viewData->shareDetails = $this->_processShareDetails();
+ $this->viewData->users = $this->_processUsers();
//=== MAIN PERIOD STATISTICS
// These are the main statistics used to build the chart and the table below it.
return collect($this->_eventsByPage['link']['subtable'] ?? [])->sortByDesc('nb_events');
}
- protected function _processMultimedia()
+ protected function _processUsers()
{
- $this->setCacheDuration(1);
+ $data = $this->apiCall('UserId.getUsers', ['flat' => 1, 'expanded' => 1, 'period' => 'range']);
+ $res = [];
+ foreach ($data as $u) {
+ $res[$u['label']] = ['userid' => $u['label'], 'nb_visits' => $u['nb_visits'], 'pages' => []];
+ try {
+ $pages = $this->apiCall('Actions.getPageUrls', ['period' => 'range', 'flat' => 1, 'segment' => 'userId==' . $u['label']]);
+ foreach ($pages as $page) {
+ $e = explode('/', $page['label']);
+ $pageNr = array_pop($e);
+ if (!is_numeric($pageNr)) {
+ continue;
+ }
+ $res[$u['label']]['pages'][] = $this->_getPageGroup($pageNr);
+ }
+ } catch (\Exception $e) {
+ }
+ }
+ return $res;
+ }
+
+ protected function _processMultimedia()
+ {
$types = ['slideshow' => ['show'], 'video' => ['play'], 'youtube' => ['play'], 'dailymotion' => ['play'], 'vimeo' => ['show'], 'popup_image' => ['show'], 'popup_multimedia' => ['show']];
$undefined = ['Nom d\'évènement indéfini'];
$u .= '&token_auth=' . rawurlencode($token) . '&cip=' . rawurlencode($_SERVER['HTTP_X_REAL_IP']);
}
file_get_contents(html_entity_decode($u));
- return response('',204);
+ return response('', 204);
}
protected function setupStatsDefaults()
$text = $td->getAttribute('data-flag');
} elseif ($td->getAttribute('sorttable_customkey')) {
$text = $td->getAttribute('sorttable_customkey');
+ } else if ($td->getAttribute('data-excel-content')) {
+ $text = $td->getAttribute('data-excel-content');
}
- $datas[$k][] = trim(preg_replace('/\s\s+/', ' ', $text));
+ $text = trim(preg_replace('/\s\s+/', ' ', $text));
+
+ $datas[$k][] = $text;
}
}
text-overflow: ellipsis;
}
+ .user-pages {
+ .with-aliases {
+ display: inline;
+ a.number {
+ display: inline;
+ }
+ }
+ }
+
.with-aliases {
.number {
font-size: 75%;
span {
margin-right: 10px;
- &:last-of-type{
+
+ &:last-of-type {
margin-right: 0;
}
}
}
@endphp
-<td data-name="page_group" sorttable_customkey="{{ $group['page_number']??0 }}">
- @if($group)
- @if(count($group['page_aliases'])>0)
- <div class="with-aliases">
- @foreach($group['page_aliases'] as $alias)
- <span class="alias">
+@if($td)
+ <td data-name="page_group" sorttable_customkey="{{ $group['page_number']??0 }}">
+ @endif
+ @if($group)
+ @if(count($group['page_aliases'])>0)
+ <div class="with-aliases">
+ @foreach($group['page_aliases'] as $alias)
+ <span class="alias">
<a target="_blank"
href="{!! $fluidbookBaseURL !!}#/page/{{\Fluidbook\Tools\Links\AnchorLink::normalizeAnchor($alias)}}">
{{$alias}}
</a>
</span>
- @endforeach
- @endif
- <a class="number" target="_blank"
- href="{!! $fluidbookBaseURL !!}#/page/{{ $group['page_number'] }}">{{$group['page_group']}}</a>
- @if(count($group['page_aliases'])>0)
- </div>
+ @endforeach
+ @endif
+ <a class="number" target="_blank"
+ href="{!! $fluidbookBaseURL !!}#/page/{{ $group['page_number'] }}">{{$group['page_group']}}</a>
+ @if(count($group['page_aliases'])>0)
+ </div>
+ @endif
@endif
- @endif
-</td>
+ @if($td)
+ </td>
+@endif
--- /dev/null
+@php
+ if($group && (is_string($group) || is_int($group))){
+ $group=$pages[$group];
+ }
+@endphp
+
+@if($td)
+ <td data-name="page_group" sorttable_customkey="{{ $group['page_number']??0 }}">
+ @endif
+ @if($group)
+ @if(count($group['page_aliases'])>0)
+ <div class="with-aliases">
+ @foreach($group['page_aliases'] as $alias)
+ <span class="alias">
+ <a target="_blank"
+ href="{!! $fluidbookBaseURL !!}#/page/{{\Fluidbook\Tools\Links\AnchorLink::normalizeAnchor($alias)}}">
+ {{$alias}}
+ </a>
+ </span>
+ @endforeach
+ @endif
+ <a class="number" target="_blank"
+ href="{!! $fluidbookBaseURL !!}#/page/{{ $group['page_number'] }}">{{$group['page_group']}}</a>
+ @if(count($group['page_aliases'])>0)
+ </div>
+ @endif
+ @endif
+ @if($td)
+ </td>
+@endif
{{ $period_title['singular'] }}
</a>
@endforeach
- <form action="{{ route("generateexcel", compact('fluidbook_id', 'hash') + ['date'=>$start_date.','.$end_date, 'period_override'=>$period]) }}" method="POST">
- @csrf
- <button class="btn btn-primary ml-3" type="submit">{{ __('Exporter au format Excel') }}</button>
- </form>
+ <form
+ action="{{ route("generateexcel", compact('fluidbook_id', 'hash') + ['date'=>$start_date.','.$end_date, 'period_override'=>$period]) }}"
+ method="POST">
+ @csrf
+ <button class="btn btn-primary ml-3" type="submit">{{ __('Exporter au format Excel') }}</button>
+ </form>
</div>
</div>
</table>
{{-- Stats segregated by page number --}}
- <h3 data-title-excel="{{ __('Page') }}" class="mt-5">{{ __('Détails par page') }} <small>({!! $formatted_date_range !!})</small></h3>
+ <h3 data-title-excel="{{ __('Page') }}" class="mt-5">{{ __('Détails par page') }}
+ <small>({!! $formatted_date_range !!})</small></h3>
<table class="{!! $tableClasses !!}">
<thead>
<tr>
@foreach (array_keys($table_map['per-page']) as $summary_key)
@if($summary_key === 'page_group')
- @include('fluidbook_stats.pagelink',['group'=>$page_data[$summary_key]])
+ @include('fluidbook_stats.pagelink',['group'=>$page_data[$summary_key],'td'=>true])
@else
<td data-name="{{ $summary_key }}">
{!! is_int($page_data[$summary_key]) ? $formatter->format($page_data[$summary_key]) : $page_data[$summary_key] !!}
<i class="{{$icons[$media['type']]}}"
data-tooltip="{{$tooltips[$media['type']]}}"></i> {{$label }}
</td>
- @include('fluidbook_stats.pagelink',['group'=>$media['pages'][0]??''])
+ @include('fluidbook_stats.pagelink',['group'=>$media['pages'][0]??'','td'=>true])
<td>{{ $formatter->format($media['nb']) }}</td>
</tr>
@endforeach
<tbody>
@foreach($countries as $key => $country)
<tr>
- <td data-flag="{{ $key }}" class="whitespace-nowrap" data-sort-value="{{ $country['label'] }}">
+ <td data-flag="{{ $key }}" class="whitespace-nowrap"
+ data-sort-value="{{ $country['label'] }}">
<img src="{{ $country['flag'] }}" alt="{{ $country['label'] }}"
style="width: 1.5em; margin-right: 0.75em;">
{{ $country['label'] }}
</div>
+ @if($users)
+ <div>
+ <h3 data-title-excel="{{ __('Utilisateurs') }}">{{ __('Utilisateurs') }}</h3>
+ <table class="{!! $tableClasses !!}">
+ <thead>
+ <tr>
+ <th style="width: 30%;">{{ __('Identifiant') }}</th>
+ <th style="width: 10%;" class="sorttable_sorted_reverse">{{ __('Visites') }}</th>
+ <th style="width: 60%;">{{ __('Pages') }}</th>
+ </tr>
+ </thead>
+ <tbody>
+ @foreach($users as $userId => $user)
+ <tr>
+ <td class="whitespace-nowrap" data-sort-value="{{ $user['userid'] }}">
+ {{ $user['userid'] }}
+ </td>
+ <td>{{ $formatter->format($user['nb_visits']) }}</td>
+ <td class="user-pages" data-excel-content="{{implode(', ',$user['pages'])}}">
+ @foreach($user['pages'] as $p)
+ @include('fluidbook_stats.pagelink_user',['group'=>$p,'td'=>false])
+ <br>
+ @endforeach
+ </td>
+ </tr>
+ @endforeach
+ </tbody>
+ </table>
+ </div>
+
+ @endif
{{-- It's possible for there to be no statistics returned by the API --}}
@else
<div class="no-statistics">