File indexing completed on 2025-05-04 05:29:26
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 0023 $loginUrl = '/login?redirect=' . $this->encryptUrl(Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(), true); 0024 $txtUserFollows = ''; 0025 $urlUserFollows = $this->buildProductUrl($this->product->project_id, 'unfollow'); 0026 $imgFile = '/theme/flatui/img/icon-like-color.png'; 0027 if (false == $this->userFollowsProject($this->authMember->member_id, $this->product->project_id)) { 0028 $txtUserFollows = ''; 0029 $urlUserFollows = $this->buildProductUrl($this->product->project_id, 'follow'); 0030 $imgFile = '/theme/flatui/img/icon-like.png'; 0031 } 0032 $titleImage = $this->Image($this->product->image_big, array('width' => 1170, 'height' => 300)); 0033 $imageTag = '<img src="' . $titleImage . '">'; 0034 if (strpos($titleImage, 'default.png') !== false) { 0035 $imageTag = ''; 0036 } 0037 ?> 0038 <?php //<script src="https://www.paypalobjects.com/js/external/apdg.js"></script> ?> 0039 0040 <div class="container page-container"> 0041 0042 <!-- HEADER --> 0043 0044 <?php 0045 echo $this->render('product/partials/productTopHeader.phtml', 0046 array( 0047 "member" => $this->member, 0048 "project" => $this->product, 0049 "loginUrl" => $loginUrl, 0050 'product_views' => $this->product_views, 0051 'tab' => 'statistics', 0052 'txtUserFollows' => $this->txtUserFollows, 0053 'urlUserFollows' => $urlUserFollows, 0054 'imgFile' => $this->imgFile 0055 )); 0056 ?> 0057 0058 0059 <!-- /HEADER --> 0060 0061 <!-- PAGE BODY --> 0062 0063 <div class="product-right full-width statistics-page"> 0064 0065 <!-- page content --> 0066 0067 <div class="col-md-8 col-lg-8 col-sm-8 col-xs-8 product-details"> 0068 0069 <!--Load the AJAX API--> 0070 <script type="text/javascript" src="https://www.google.com/jsapi"></script> 0071 <script type="text/javascript"> 0072 0073 // Load the Visualization API and the piechart package. 0074 google.load('visualization', '1', {'packages': ['corechart']}); 0075 0076 // Set a callback to run when the Google Visualization API is loaded. 0077 google.setOnLoadCallback(drawChart); 0078 0079 function drawChart() { 0080 0081 $.ajax({ 0082 type: 'POST', 0083 url: '/statistics/daily/ajax/project_id/<?php echo $this->product->project_id; ?>/year/<?php echo $this->year; ?>/month/<?php echo $this->month; ?>/day/<?php echo $this->day; ?>', 0084 0085 beforeSend: function () { 0086 // this is where we append a loading image 0087 $('#chart_div_daily').html('<h5>Daily Statistic</h5><div class="loading"><img src="/images/system/ajax-loader.gif" alt="Loading..." /></div>'); 0088 }, 0089 success: function (response) { 0090 try { 0091 if (response == 'null') { 0092 throw new Error('no data found'); 0093 } 0094 0095 // Create our data table out of JSON data loaded from server. 0096 var data = google.visualization.arrayToDataTable(response); 0097 0098 // Instantiate and draw our chart, passing in some options. 0099 var chart = new google.visualization.ColumnChart(document.getElementById('chart_div_daily')); 0100 chart.draw(data, {title: 'Daily Statistic', width: 600, height: 400}); 0101 0102 } catch (e) { 0103 $('#chart_div_daily').html('<h5>Daily Statistic</h5><p>' + e.message + '</p>'); 0104 } 0105 0106 // successful request; do something with the data 0107 $('#ajax-panel').empty(); 0108 $(data).find('item').each(function (i) { 0109 $('#ajax-panel').append('<h4>' + $(this).find('title').text() + '</h4><p>' + $(this).find('link').text() + '</p>'); 0110 }); 0111 }, 0112 error: function () { 0113 // failed request; give feedback to user 0114 $('#chart_div_daily').html('<h5>Daily Statistic</h5><p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>'); 0115 } 0116 }); 0117 0118 $.ajax({ 0119 type: 'POST', 0120 url: '/statistics/weekly/ajax/project_id/<?php echo $this->product->project_id; ?>/yearweek/<?php echo $this->yearweek; ?>/', 0121 0122 beforeSend: function () { 0123 // this is where we append a loading image 0124 $('#chart_div_weekly').html('<h5>Weekly Statistic</h5><div class="loading"><img src="/images/system/ajax-loader.gif" alt="Loading..." /></div>'); 0125 }, 0126 success: function (response) { 0127 try { 0128 if (response == 'null') { 0129 throw new Error('no data found'); 0130 } 0131 0132 // Create our data table out of JSON data loaded from server. 0133 var dataTable = google.visualization.arrayToDataTable(response); 0134 0135 // Instantiate and draw our chart, passing in some options. 0136 var chart = new google.visualization.LineChart(document.getElementById('chart_div_weekly')); 0137 chart.draw(dataTable, { 0138 title: 'Weekly Statistic', 0139 width: 600, 0140 height: 400, 0141 hAxis: { 0142 title: 'day', 0143 format: '#', 0144 gridlines: {count: dataTable.getNumberOfRows()} 0145 } 0146 }); 0147 0148 } catch (e) { 0149 $('#chart_div_weekly').html('<h5>Weekly Statistic</h5><p>' + e.message + '</p>'); 0150 } 0151 0152 }, 0153 error: function () { 0154 // failed request; give feedback to user 0155 $('#chart_div_weekly').html('<h5>Weekly Statistic</h5><p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>'); 0156 } 0157 }); 0158 0159 $.ajax({ 0160 type: 'POST', 0161 url: '/statistics/monthly/ajax/project_id/<?php echo $this->product->project_id; ?>/year/<?php echo $this->year; ?>/month/<?php echo $this->month; ?>/', 0162 0163 beforeSend: function () { 0164 // this is where we append a loading image 0165 $('#chart_div_monthly').html('<h5>Monthly Statistic</h5><div class="loading"><img src="/images/system/ajax-loader.gif" alt="Loading..." /></div>'); 0166 }, 0167 success: function (response) { 0168 try { 0169 if (response == 'null') { 0170 throw new Error('no data found'); 0171 } 0172 0173 // Create our data table out of JSON data loaded from server. 0174 var dataTable = google.visualization.arrayToDataTable(response); 0175 0176 // Instantiate and draw our chart, passing in some options. 0177 var chart = new google.visualization.LineChart(document.getElementById('chart_div_monthly')); 0178 chart.draw(dataTable, { 0179 title: 'MonthlyStatistic', 0180 width: 600, 0181 height: 400, 0182 hAxis: { 0183 title: 'week', 0184 format: '#', 0185 gridlines: {count: dataTable.getNumberOfRows()} 0186 } 0187 }); 0188 0189 } catch (e) { 0190 $('#chart_div_monthly').html('<h5>Monthly Statistic</h5><p>' + e.message + '</p>'); 0191 } 0192 0193 }, 0194 error: function () { 0195 // failed request; give feedback to user 0196 $('#chart_div_monthly').html('<h5>Monthly Statistic</h5><p class="error"><strong>Oops!</strong> Try that again in a few moments.</p>'); 0197 } 0198 }); 0199 0200 } 0201 </script> 0202 <div id="chart_div_daily" name="chart_div_daily"></div> 0203 <div id="chart_div_weekly" name="chart_div_weekly"></div> 0204 <div id="chart_div_monthly" name="chart_div_monthly"></div> 0205 0206 </div> 0207 <!-- /.product-details --> 0208 0209 <!-- /page content --> 0210 0211 <!-- sidebar --> 0212 0213 <?php echo $this->render('product/partials/sidebar.phtml', 0214 array( 0215 'member' => $this->member, 0216 'project' => $this->product, 0217 'comments' => $this->comments, 0218 'supporter' => $this->supporter, 0219 'relatedProducts' => $this->relatedProducts, 0220 )); 0221 ?> 0222 0223 <!-- /sidebar --> 0224 0225 </div> 0226 0227 <!-- PAGE BODY --> 0228 0229 </div> 0230 0231 <?php $this->inlineScript()->appendScript( 0232 ' $(document).ready(function(){ 0233 0234 }); 0235 '); 0236