File indexing completed on 2025-05-04 05:29:30
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 ?> 0024 <style> 0025 .cell-default { 0026 line-height: 4em; 0027 vertical-align: middle; 0028 } 0029 .row-total { 0030 border-top: #1595ee solid thin; 0031 padding-top: 1em; 0032 padding-bottom: 1em; 0033 line-height: 30px; 0034 } 0035 0036 .popover { 0037 min-width:350px; 0038 } 0039 0040 .popover-title { 0041 text-transform: none; 0042 font-size: 11pt; 0043 } 0044 0045 .popover-content { 0046 text-transform: none; 0047 font-size: 11pt; 0048 } 0049 </style> 0050 <ul class="nav nav-tabs margin-bottom-10"> 0051 <?php 0052 0053 $isCurrentMonth = false; 0054 $modelDownload = new Default_Model_StatDownload(); 0055 $yearmonth = null; 0056 0057 if(isset($this->yearmonth)) { 0058 $yearmonth = $this->yearmonth; 0059 } 0060 0061 $section_id = null; 0062 0063 if(isset($this->section_id) && $this->section_id != '') { 0064 $section_id = $this->section_id; 0065 } 0066 0067 ?> 0068 0069 <div class="tab-content"> 0070 <?php 0071 $helperUserRole = new Backend_View_Helper_UserRole(); 0072 $userRoleName = $helperUserRole->userRole(); 0073 0074 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0075 $helpImage = new Default_View_Helper_Image(); 0076 $css_active = ' in active'; 0077 $has_paypal = false; 0078 $currency = new Zend_Currency('en_US'); 0079 0080 $currentDate = date("Ym",time()); 0081 $printCurrentMonth = new DateTime($currentDate.'01'); 0082 0083 $printMonth = new DateTime($yearmonth.'01'); 0084 $printDate = $printMonth->format('M Y'); 0085 0086 if(null != $section_id) { 0087 $allDownloads = $modelDownload->getUserDownloadsAndViewsForMonthAndSection($this->member->member_id, $yearmonth, $section_id); 0088 } else { 0089 $allDownloads = $modelDownload->getUserDownloadsAndViewsForMonth($this->member->member_id, $yearmonth); 0090 } 0091 0092 $countDownloadsOverall = count($allDownloads); 0093 0094 if ($countDownloadsOverall > 0) { 0095 $firstProduct = $allDownloads[0]; 0096 if ($firstProduct) { 0097 $printMonth = new DateTime($firstProduct['yearmonth'].'01'); 0098 $printCurrentMonth = new DateTime($currentDate.'01'); 0099 0100 if($printMonth == $printCurrentMonth) { 0101 $isCurrentMonth = true; 0102 } else { 0103 $isCurrentMonth = false; 0104 } 0105 $sum_total_month_score = 0; 0106 $sum_total_month = 0; 0107 $sum_total_month_uk = 0; 0108 $sum_total_month_new = 0; 0109 $sum_total_text = ''; 0110 $sum_total_payout = 0; 0111 $sum_total_payout_uk = 0; 0112 $sum_total_payout_new = 0; 0113 0114 $sum_total_month_potential_payout = 0; 0115 $sum_total_potential_payout = 0; 0116 0117 ?> 0118 <div class="tab-pane fade <?=$css_active?>" id="<?=$firstProduct['yearmonth']?>"> 0119 <?php 0120 $css_active = ''; 0121 0122 foreach ($allDownloads as $product) { ?> 0123 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0124 <div class="col-md-1 cell-default" style="min-width: 150px;"> 0125 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0126 <img src="<?php echo $helpImage->Image($product['image_small'], array('width' => 80, 'height' => 65)); ?> " height="81" width="101"/> 0127 </a> 0128 </div> 0129 <div class="col-md-3 text-left cell-default"> 0130 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0131 <span style="line-height: 3em;"><?= $product['title']; ?></span> 0132 </a> 0133 <b style="display: block; margin-bottom: 5px; font-size: 10pt; line-height: 0em;"><?=$product['cat_title']?></b> 0134 </div> 0135 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0136 <span><?= $product['num_downloads_micropayout'] ?></span> 0137 </div> 0138 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0139 <span><?= $product['num_views_micropayout'] ?></span> 0140 </div> 0141 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0142 <span><?= $product['category_pling_factor'] ?></span> 0143 </div> 0144 0145 0146 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0147 <span style="color: #BBB"><?php print($currency->toCurrency($product['amount_downloads_micropayout'] + $product['amount_views_micropayout'])); ?></span> 0148 </div> 0149 0150 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0151 <span> 0152 <?php 0153 $errorMsg = "<ul>"; 0154 $showErrMsg = false; 0155 0156 if($isCurrentMonth) { 0157 if($product['is_license_missing_now'] == 1) { 0158 $errorMsg .= "<li>Please specify a License</li>"; 0159 $showErrMsg = true; 0160 } 0161 if($product['is_source_missing_now'] == 1) { 0162 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0163 $showErrMsg = true; 0164 } 0165 if($product['is_pling_excluded_now'] == 1) { 0166 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0167 $showErrMsg = true; 0168 } 0169 $sum_plings = $product['num_plings_now']; 0170 } else { 0171 if($product['is_license_missing'] == 1) { 0172 $errorMsg .= "<li>License was not specified</li>"; 0173 $showErrMsg = true; 0174 } 0175 if($product['is_source_missing'] == 1) { 0176 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0177 $showErrMsg = true; 0178 } 0179 if($product['is_pling_excluded'] == 1) { 0180 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0181 $showErrMsg = true; 0182 } 0183 $sum_plings = $product['num_plings']; 0184 0185 } 0186 $errorMsg .= "</ul>"; 0187 0188 if($showErrMsg) { 0189 echo '<div class="inline msg-popover-danger" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Payout requirements are not fulfilled" data-trigger="hover" data-html="true" data-content="'.$errorMsg.'"><span style="color: #a94442;" class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span></div>'; 0190 } else { 0191 print($currency->toCurrency($product['amount_downloads_micropayout'] + $product['amount_views_micropayout'])); 0192 } 0193 ?> 0194 </span> 0195 0196 </div> 0197 0198 <?php if(!$showErrMsg) { 0199 //$payout_sum = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0200 $payout_sum = 0; 0201 $payout_sum_uk = 0; 0202 $payout_sum_new = ($product['amount_downloads_micropayout'] + $product['amount_views_micropayout']); 0203 0204 $show_payout_new_sum = $payout_sum_new; 0205 $show_payout_sum = $payout_sum; 0206 0207 $payout_sum_uk = ($product['amount_downloads_micropayout'] + $product['amount_views_micropayout']); 0208 0209 if($sum_plings && $sum_plings < $payout_sum) { 0210 $show_payout_new_sum = $sum_plings; 0211 $payout_sum_new = $sum_plings; 0212 } 0213 if($sum_plings && $sum_plings>0) { 0214 $show_payout_new_sum = $show_payout_new_sum ; 0215 0216 } else { 0217 $show_payout_new_sum = $payout_sum_new; 0218 } 0219 ?> 0220 <?php } ?> 0221 </div> 0222 <?php 0223 0224 $sum_total_month_potential_payout += ($product['amount_downloads_micropayout'] + $product['amount_views_micropayout']); 0225 $sum_total_potential_payout = $currency->toCurrency($sum_total_month_potential_payout); 0226 0227 if(!$showErrMsg) { 0228 $sum_total_month += $payout_sum; 0229 $sum_total_month_uk += $payout_sum_uk; 0230 $sum_total_payout = $currency->toCurrency($sum_total_month); 0231 $sum_total_payout_uk = $currency->toCurrency($sum_total_month_uk); 0232 $sum_total_month_new += $show_payout_new_sum; 0233 $sum_total_payout_new = $currency->toCurrency($sum_total_month_new); 0234 } 0235 0236 $sum_total_text = 'Possible payout for this month (<span style="font-size: smaller;">*</span>):'; 0237 0238 $payout_success = false; 0239 if ($product['status'] == Default_Model_DbTable_MemberPayout::$PAYOUT_STATUS_COMPLETED) { 0240 $payout_success = true; 0241 $sum_total_payout_success = $currency->toCurrency($product['amount']); 0242 $sum_total_text_success = 'Actually successfully paid amount: '; 0243 } 0244 $has_paypal = $product['paypal_mail'] ? true : false; 0245 } 0246 0247 $sum_total_month_view = number_format($sum_total_month); 0248 ?> 0249 <div class='row row-total'> 0250 <div class="col-md-1" style="min-width: 150px;"></div> 0251 <div class="col-md-3 text-left text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"></div> 0252 <div class="col-md-3 text-right nowrap" style="white-space: nowrap; min-width: 570px;"><?=$sum_total_text?></div> 0253 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong style="color: #BBB"><?=$sum_total_potential_payout?></strong></div> 0254 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong><?=$sum_total_payout_uk?>**</strong></div> 0255 </div> 0256 0257 0258 0259 <?php 0260 0261 0262 $currentDate = date("Ym",time()); 0263 $viewDate = $firstProduct['yearmonth'].""; 0264 $paypalWarning = ''; 0265 if($currentDate == $viewDate) { 0266 $member = $this->view_member; 0267 if(!isset($member['paypal_mail']) || $member['paypal_mail'] == '') { 0268 $has_paypal = false; 0269 $paypalWarning = 'You have no PayPal account configured. Please go to your settings page <a href="/settings#form-payment-panel">here</a>.'; 0270 } else { 0271 $has_paypal = true; 0272 } 0273 } else { 0274 $paypalWarning = 'We found no valid Paypal account for this month. That\'s why we could not pay you any money. In order to receive money for the current month, please make sure that a paypal account is registered. Go to your settings page <a href="/settings#form-payment-panel">here</a>.'; 0275 } 0276 if (false == $has_paypal) { 0277 echo '<div class="alert alert-danger" role="alert">'.$paypalWarning.'</div>'; 0278 } 0279 0280 if (($sum_total_month/100) < 1) { 0281 echo '<div class="alert alert-warning" role="alert">We only pay out money if the total sum is over $1.</div>'; 0282 } 0283 ?> 0284 0285 </div> 0286 <?php 0287 } 0288 } else { 0289 0290 echo '<div class="tab-pane fade in active" id="'.$printDate.'">'; 0291 echo ' <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>'; 0292 echo ' <div class="row row-total">'; 0293 echo ' <div class="col-md-1 text-right" style="min-width: 150px;"></div><div class="col-md-4 text-right"></div><div class="col-md-3 text-right" style="min-width: 570px;">Possible payout for this month (<span style="font-size: smaller;">*</span>):</div><div class="col-md-1 text-right" style="min-width: 190px;"><strong>$0.00</strong></div>'; 0294 echo ' </div>'; 0295 echo '</div>'; 0296 } 0297 0298 0299 ?> 0300 0301 <?php /* 0302 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0303 <p>(**) The Payout is planned to become active on May 2019.</p> 0304 </div> 0305 */ ?> 0306 0307 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0308 <p>(*) Info:</p> 0309 <p>This service will become active on May, 1st 2017. All previous months are shown for internal testing only. 0310 </p> 0311 <p>This service is considered Beta until otherwise announced.</p> 0312 <br> 0313 <p>For the full Terms of Service, please read here: <a href="/terms/payout">Payout T&C</a></p> 0314 <br><br> 0315 <p>**Paypal might deduct general fees and conversion rate from this sum.</p> 0316 0317 </div> 0318 </div> 0319 0320 <script> 0321 $('#payout_info').click(function (event ) { 0322 event.preventDefault(); 0323 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0324 }); 0325 0326 $('.close').click(function () { 0327 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0328 }); 0329 0330 $(function(){ 0331 // Enables popover 0332 $(".payout-popover-info").popover({ 0333 html : true, 0334 template : '<div class="popover alert alert-info alert-block" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 0335 }); 0336 $(".payout-popover-warning").popover({ 0337 html : true, 0338 template : '<div class="popover alert alert-warning alert-block" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 0339 }); 0340 $(".payout-popover-success").popover({ 0341 html : true, 0342 template : '<div class="popover alert alert-success alert-block" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 0343 }); 0344 $(".payout-popover-danger").popover({ 0345 html : true, 0346 template : '<div class="popover alert alert-danger alert-block" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 0347 }); 0348 $(".msg-popover-danger").popover({ 0349 html : true, 0350 template : '<div class="popover alert alert-danger alert-block" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 0351 }); 0352 }); 0353 0354 </script> 0355 0356 <?php $this->inlineScript()->appendScript( 0357 ' $(document).ready(function(){ 0358 $(\'[data-toggle="popover"]\').popover(); 0359 }); 0360 ');