Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/views/statistics/index.thtml
blob: 7624f1c8148a620cdd0e22b0fab490a78282a89f (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is addons.mozilla.org site.
 *
 * The Initial Developer of the Original Code is
 * The Mozilla Foundation.
 * Portions created by the Initial Developer are Copyright (C) 2008
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Justin Scott <fligtar@mozilla.com> (Original Author)
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */
?>
<h1><?=___('Statistics Dashboard', 'statistics_index_title')?></h1>

<div class="secondary" role="complementary">
  <div class="highlight">
    <h2><?=___('Site Statistics')?></h2>
    <dl>
      <dt><?=$html->number_format($statsOverview['totalDownloads'])?></dt>
      <dd><?=___('Add-ons Downloaded', 'statistics_addons_downloaded')?></dd>

      <dt><?=$html->number_format($statsOverview['totalInUse'])?></dt>
      <dd><?=___('Add-ons In Use')?></dd>

      <dt><?=$html->number_format($statsOverview['totalUsers'])?></dt>
      <dd><?=___('Registered Users')?></dd>

      <dt><?=$html->number_format($statsOverview['totalReviews'])?></dt>
      <dd><?=___('Add-on Reviews')?></dd>

      <dt><?=$html->number_format($statsOverview['totalCollections'])?></dt>
      <dd><?=___('Add-on Collections')?></dd>
    </dl>
  </div>

  <?php /* echo $this->renderElement('developers/myaddons', array('addons' => $addons)); */ ?>
</div>

<div class="primary">
  <div id="content-main" class="article">
    <div id="plot-options" style="display: none;">
      <div id="plot-selector-area"></div>
      <div id="plot-selection"></div>
    </div>

    <div id="timeplot-container">
      <div id="not-enough-data" class="warning" style="display: none;"><div>
        <?=___('There is not yet enough data to display this graph. Please check back later.')?>
      </div></div>

      <noscript>
        <div class="warning"><div>
          <?=___('JavaScript is required to view the Statistics Dashboard graphs.')?>
        </div></div>
      </noscript>
    </div>
  </div>

  <div id="stats-table-listing" class="featured listing results">
    <div class="featured-inner">
      <table id="stats-table-instance">
        <thead>
          <tr class="header">
            <th class="first"><?=___('Date', 'list_sortby_date')?></th>
            <th><?=___('Add-ons Downloaded', 'statistics_addons_downloaded')?></th>
            <th><?=___('Add-ons In Use')?></th>
            <th><?=___('Add-ons Created')?></th>
            <th><?=___('Add-ons Updated')?></th>
            <th><?=___('Accounts Created')?></th>
            <th><?=___('Reviews Created')?></th>
            <th class="last"><?=___('Collections Created')?></th>
          </tr>
        </thead>
        <tbody>
        <?php
          $i = 0;
          foreach ($stats as $row):
              $i++;
              if ($i > 18) break; // nonJS case: show the date-range that would initially be charted
        ?>
          <tr class="row <?=($i % 2 ? 'odd' : 'even')?>">
            <td class="col first"><?=strftime(___('%B %e, %Y'), strtotime($row['date']))?></td>
            <td class="col value"><?=$html->number_format($row['addons_downloaded'])?></td>
            <td class="col value"><?=$html->number_format($row['addons_in_use'])?></td>
            <td class="col value"><?=$html->number_format($row['addons_created'])?></td>
            <td class="col value"><?=$html->number_format($row['addons_updated'])?></td>
            <td class="col value"><?=$html->number_format($row['users_created'])?></td>
            <td class="col value"><?=$html->number_format($row['reviews_created'])?></td>
            <td class="col value last"><?=$html->number_format($row['collections_created'])?></td>
          </tr>
        <?php endforeach; ?>
        </tbody>

      </table>
    </div>
    <div class="listing-footer">
      <ol id="stats-table-pagination" class="pagination"></ol>
      <a href="<?=$html->url('/statistics/sitecsv/week')?>" id="stats-csv-download"><?php echo ___('View this table in CSV format') ?></a>
    </div>
  </div>


<?php
    echo '<h3>'.___('Add-on statistics', 'addons_statistics_header').'</h3>';
    echo '<div class="featured prose">';
    echo '<div class="featured-inner article">';
        if (!empty($addons)) {
            echo '<p>'.___('Select one of your add-ons to view its statistics').':</p>';
            echo '<ul>';
            foreach ($addons as $id => $addon) {
                echo '<li>'.$html->link($addon, '/statistics/addon/'.$id).'</li>';
            }
            echo '</ul>';
        }

        if (!empty($otherAddons)) {
            echo '<p>';
            if (!empty($addons)) {
                if ($this->controller->SimpleAcl->actionAllowed('Admin', 'ViewAnyStats', $this->controller->Session->read('User')))
                    echo ___('or, select another add-on').':';
                else
                    echo ___('or, select an add-on with public statistics').':';
            }
            else {
                if ($this->controller->SimpleAcl->actionAllowed('Admin', 'ViewAnyStats', $this->controller->Session->read('User')))
                    echo ___('Select an add-on to view its statistics').':';
                else
                    echo ___('Select an add-on with public statistics').':';
            }
            echo '</p>';

            echo $html->formTag('/statistics/', 'get');
            echo $html->selectTag('Addon/id', $otherAddons, null, array('onChange' => 'changeAddon(this);'));
            echo '<noscript><input type="submit" value="'.___('View Statistics').'"></noscript>';
            echo '</form>';
        }
    echo '</div>';
    echo '</div>';
?>
</div>

<script type="text/javascript">
// <![CDATA[
    var statsURL = '<?=$html->url('/statistics/')?>';
    $(document).ready(function() {
        $('#plot-options').show();
        Plots.dataTable = new PlotDataTable({
            tableId: 'stats-table-instance',
            paginationId: 'stats-table-pagination',
            downloadLinkId: 'stats-csv-download',
            ignoreToday: '<?=date('Y-m-d')?>'
        });
        Plots.initialize();
        plotSelection.initialize();
    });
// ]]>
</script>