Welcome to mirror list, hosted at ThFree Co, Russian Federation.

table_by_segment.tpl « templates « Goals « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3dfa45eaa574e279930e5ae4cf5036b4ef66395d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<h2 id='titleGoalsBySegment'>{if isset($idGoal)}
	{'Goals_GoalConversionsBySegment'|translate:$goalName}
	{else}{'Goals_ConversionsOverviewBySegment'|translate}{/if}</h2> 

<div class='segmentSelector' style='float: left;width: 220px;padding-left: 10px;height:450px'>
	{foreach from=$goalSegments key=segmentFamilyName item=segments}
		{'Goals_ViewGoalsBySegment'|translate:$segmentFamilyName}
		<ul class='listCircle'>
		{foreach from=$segments item=segment}
			<li title='{'Goals_ViewGoalsBySegment'|translate:$segment.name}' class='goalSegment' module='{$segment.module}' action='{$segment.action}'>
				<span class='segment'>{$segment.name}</span>
			</li>
		{/foreach}
		</ul>
	{/foreach}
</div>

<div style='float: left;'>
	{ajaxLoadingDiv id=tableGoalsLoading}
	
	<div id='tableGoalsBySegment'></div>
</div>
<div style='clear:both'></div>
{literal}
<script type="text/javascript">
$(document).ready( function() {
	var countLoaded = 0;
	/* 
	 * For each 'segment' in the list, a click will trigger an ajax request to load the datatable 
	 * showing Goals metrics (conversion, conv. rates, revenue) for this segment
	 */
	$('.goalSegment').click( function() {
		var self = this;
		$('.goalSegment').removeClass('activeSegment');
		$(this).addClass('activeSegment');
		var module = $(this).attr('module');
		var action = $(this).attr('action');
		widgetUniqueId = module+action;
		self.expectedWidgetUniqueId = widgetUniqueId;
		
		var idGoal = broadcast.getValueFromHash('idGoal');
		var widgetParameters = {
			'module': module,
			'action': action,
			'viewDataTable': 'tableGoals',
			'filter_only_display_idgoal': idGoal.length ? idGoal : 0 // 0 is Piwik_DataTable_Filter_UpdateColumnsWhenShowAllGoals::GOALS_FULL_TABLE
		};
		var onWidgetLoadedCallback = function (response) {
			if(widgetUniqueId != self.expectedWidgetUniqueId) {
				return;
			}
			$('#tableGoalsBySegment').html($(response));
			$('#tableGoalsLoading').hide();
			$('#tableGoalsBySegment').show();
			
			countLoaded++;
			// only scroll down to the loaded datatable if this is not the first one
			// otherwise, screen would jump down to the table when loading the report 
			if(countLoaded > 1)
			{
				piwikHelper.lazyScrollTo("#titleGoalsBySegment", 400);
			}
		};
		$('#tableGoalsBySegment').hide();
		$('#tableGoalsLoading').show();
		ajaxRequest = widgetsHelper.getLoadWidgetAjaxRequest(widgetUniqueId, widgetParameters, onWidgetLoadedCallback);
		$.ajax(ajaxRequest);
	});
	$('.goalSegment').first().click();
});
</script>
{/literal}