Pluf Framework

Pluf Framework Commit Details


Date:2010-03-25 03:23:22 (15 years 1 month ago)
Author:Loic d'Anterroches
Branch:develop, master
Commit:6523fb7bf6b52a36a2f4cffea777992938e73366
Parents: cb980652386ef9a7462fb11f4d996b6384eb4859
Message:Added filtering of the funnel data by predefined periods.

Changes:

File differences

src/Pluf/AB/Funnel.php
7171
7272
7373
74
74
7575
7676
7777
......
105105
106106
107107
108
109
110
108111
109112
110113
        }
        switch ($period) {
        case 'yesterday':
            $q = array('t' => array('$eq' => (int) gmdate('Ymd', time()-86400)));
            $q = array('t' => (int) gmdate('Ymd', time()-86400));
            break;
        case 'today':
            $q = array('t' => (int) gmdate('Ymd'));
            }
        }
        // Now, compile the stats for steps 2 to n
        if (!isset($steps[1]['total'])) {
            return array();
        }
        $t1 = $steps[1]['total'];
        for ($i=2;$i<=20;$i++) {
            if ($steps[$i] and $steps[$i-1]) {
src/Pluf/AB/Views.php
110110
111111
112112
113
113
114
115
116
117
118
119
120
121
122
123
124
125
114126
115127
116128
129
130
117131
118132
119133
                                         'Pluf_AB.view-funnels'));
    public function funnel($request, $match)
    {
        $stats = Pluf_AB_Funnel::getStats($match[1]);
        $periods = array('yesterday' => __('Yesterday'),
                         'today' => __('Today'),
                         '7days' => __('Last 7 days'),
                         'all' => __('All time'));
        $period = 'today';
        $nperiod = $periods[$period];
        if (isset($request->REQUEST['p'])
            and isset($periods[$request->REQUEST['p']])) {
            $period = $request->REQUEST['p'];
            $nperiod = $periods[$request->REQUEST['p']];
        }
        //'yesterday', ('today'), '7days', 'all'        
        $stats = Pluf_AB_Funnel::getStats($match[1], $period);
        return Pluf_Shortcuts_RenderToResponse('pluf/ab/funnel.html',
                                               array('stats' => $stats,
                                                     'funnel' => $match[1],
                                                     'nperiod' => $nperiod,
                                                     'period' => $period,
                                                     ),
                                               $request);
    }
src/Pluf/templates/pluf/ab/base.html
6262
6363
6464
65
66
67
68
6569
6670
6771
  padding: 0;
}
.strong {
   font-weight: bold;
}
.note, .details {
   font-size: 0.8em;
}
src/Pluf/templates/pluf/ab/funnel.html
33
44
55
6
6
7
8
9
10
11
12
13
14
15
16
17
718
819
920
......
2435
2536
2637
27
38
2839
2940
3041
......
3546
3647
3748
38
49
50
51
3952
4053
4154
{block body}
<p class="right">&raquo; <a href="{url 'pluf_ab_funnels'}">All funnels</a></p>
<h1>Funnel {$funnel}</h1>
<h1>Funnel {$funnel} - {$nperiod}</h1>
<p class="right">
<a{if $period == 'today'} class="strong"{/if} href="{url 'pluf_ab_funnel', array($funnel), array('p'=> 'today')}">Today</a> |
<a{if $period == 'yesterday'} class="strong"{/if} href="{url 'pluf_ab_funnel', array($funnel), array('p'=> 'yesterday')}">Yesterday</a> |
<a{if $period == '7days'} class="strong"{/if} href="{url 'pluf_ab_funnel', array($funnel), array('p'=> '7days')}">Last 7 days</a> |
<a{if $period == 'all'} class="strong"{/if} href="{url 'pluf_ab_funnel', array($funnel), array('p'=> 'all')}">All time</a>
</p>
{assign $i=1}
{foreach $stats as $step}{if $step}
{if $i>1}
</p>
{assign $i += 1}
{/if}{/foreach}
{if count($stats)}
<hr />
{assign $i = $i-1}
Note that if a user skip a given step, this can make the results a bit
off.
</p>
{else}
<p>We do not have statistics for this period.</p>
{/if}
{/block}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.11163s using 13 queries.