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 if ($this->countDownloadsOverall > 0) { 0055 0056 $currentMonth = ''; 0057 $monthlyDownload = null; 0058 $allDownloads = array(); 0059 $css_active = 'active'; 0060 $currentDate = date("Ym",time()); 0061 $printCurrentMonth = new DateTime($currentDate.'01'); 0062 0063 foreach ($this->downloads as $download) { 0064 $printMonth = new DateTime($download['yearmonth'].'01'); 0065 0066 $printDate = $printMonth->format('M Y'); 0067 $printDateNow = $printCurrentMonth->format('M Y'); 0068 0069 if($printDateNow == $printDate) { 0070 $printDate = 'Current month'; 0071 $isCurrentMonth = true; 0072 } else { 0073 $isCurrentMonth = false; 0074 } 0075 0076 if ($printDate != $currentMonth) { 0077 $monthlyDownload = array(); 0078 $currentMonth = $printDate; 0079 0080 ?> 0081 0082 <?php 0083 $showDiv = false; 0084 $infoTextLinkToPaypal = ""; 0085 0086 if(isset($download['payment_transaction_id'])) { 0087 $infoTextLinkToPaypal = ' Your PayPal TransactionId:'.$download['payment_transaction_id'].'.'; 0088 } 0089 $payoutStatusTable = new Default_Model_DbTable_PayoutStatus(); 0090 $payoutStatus = $payoutStatusTable->find($download['status'])->current(); 0091 0092 $infoTitle = $payoutStatus['title']; 0093 $infoText = $payoutStatus['description']; 0094 $infoIconStyle = "color: ".$payoutStatus['color']." "; 0095 $infoClass = $payoutStatus['type']; 0096 $infoIcon = $payoutStatus['icon']; 0097 0098 $infoText .= $infoTextLinkToPaypal; 0099 0100 $popover = ""; 0101 if(isset($download['status']) && isset($infoText)) { 0102 $popover = '<div class="inline payout-popover-'.$infoClass.'" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="'.$infoTitle.'" data-trigger="hover" data-html="true" data-content="'.$infoText.'"><span style="'. $infoIconStyle .'" class="glyphicon '.$infoIcon.'" aria-hidden="true"></span></div>'; 0103 } 0104 ?> 0105 <li class="<?=$css_active?> "> 0106 <a href="#<?= $download['yearmonth'] ?>" data-toggle="tab"><?= $printDate ?><?= $popover ?></a> 0107 </li> 0108 0109 <?php 0110 } 0111 $css_active = ''; 0112 $monthlyDownload[] = $download; 0113 $allDownloads[$download['yearmonth']] = $monthlyDownload; 0114 } 0115 0116 } else { 0117 $currentMonth = ''; 0118 $currentDate = date("Ym",time()); 0119 $printMonth = new DateTime($currentDate.'01'); 0120 0121 $printDate = $printMonth->format('M Y'); 0122 $printDate = 'Current month'; 0123 ?> 0124 <li class="in active"><a href="#<?= $currentDate ?>" data-toggle="tab"><?= $printDate ?></a></li> 0125 <?php 0126 } 0127 ?> 0128 </ul> 0129 0130 <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;"> 0131 <div class="row"> 0132 <div class="col-md-1"></div> 0133 <?php 0134 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0135 ?> 0136 <div class="col-md-3 text-left text-uppercase nowrap" style="white-space: nowrap;"><strong>Products</strong></div> 0137 <?php 0138 } else { 0139 ?> 0140 <div class="col-md-5 text-left text-uppercase nowrap" style="white-space: nowrap;"><strong>Products</strong></div> 0141 <?php 0142 } 0143 ?> 0144 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong>Downloads</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Downloads" data-trigger="hover" data-html="true" data-content="Sum of all downloads of all files (active or archived of this product within this month."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0145 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong>Pling-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Pling-Factor" data-trigger="hover" data-html="true" data-content="The Pling-Factor's base is $-cent and depends on the product category.<br>A factor of '1' means:<br>1 Download equals 1 $-cent."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0146 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong style="color: green;">Payout</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Payout" data-trigger="hover" data-html="true" data-content="This shows the amount that will be paid out to you until May 2019."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0147 0148 <?php 0149 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0150 ?> 0151 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong>Score-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Score" data-trigger="hover" data-html="true" data-content="The product score."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0152 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong>Payout</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Payout" data-trigger="hover" data-html="true" data-content="The payout amount."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0153 <?php 0154 } 0155 ?> 0156 0157 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong style="color: #BBB">Plings</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Plings" data-trigger="hover" data-html="true" data-content="Plings = 1 System Pling + Supporter Plings for that product."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0158 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap;"><strong style="color: #BBB">Potential Payout**</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Potential Payout" data-trigger="hover" data-html="true" data-content="This new Payout will become active in May 2019."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0159 </div> 0160 </div> 0161 <div class="tab-content"> 0162 <?php 0163 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0164 $helpImage = new Default_View_Helper_Image(); 0165 $css_active = ' in active'; 0166 $has_paypal = false; 0167 $currency = new Zend_Currency('en_US'); 0168 if ($this->countDownloadsOverall > 0) { 0169 foreach ($allDownloads as $month => $products) { 0170 $printMonth = new DateTime($month.'01'); 0171 $printCurrentMonth = new DateTime($currentDate.'01'); 0172 0173 if($printMonth == $printCurrentMonth) { 0174 $isCurrentMonth = true; 0175 } else { 0176 $isCurrentMonth = false; 0177 } 0178 $sum_total_month_score = 0; 0179 $sum_total_month = 0; 0180 $sum_total_month_new = 0; 0181 $sum_total_text = ''; 0182 $sum_total_payout = 0; 0183 $sum_total_payout_new = 0; 0184 ?> 0185 <div class="tab-pane fade <?=$css_active?>" id="<?=$month?>"> 0186 <?php 0187 $css_active = ''; 0188 0189 foreach ($products as $product) { ?> 0190 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0191 0192 <div class="col-md-1 cell-default"> 0193 <a href="<?= $helperBuildProductUrl->buildProductUrl($product['project_id'], ''); ?>"> 0194 <img src="<?php echo $helpImage->Image($product['image_small'], array('width' => 80, 'height' => 65)); ?> " height="81" width="101"/> 0195 </a> 0196 </div> 0197 <?php 0198 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0199 ?> 0200 <div class="col-md-3 text-left cell-default"> 0201 <?php 0202 } else { 0203 ?> 0204 <div class="col-md-5 text-left cell-default"> 0205 <?php 0206 } 0207 ?> 0208 0209 0210 <a href="<?= $helperBuildProductUrl->buildProductUrl($product['project_id'], ''); ?>"> 0211 <span style="line-height: 3em;"><?= $product['title']; ?></span> 0212 </a> 0213 <b style="display: block; margin-bottom: 5px; font-size: 10pt; line-height: 0em;"><?=$product['cat_title']?></b> 0214 </div> 0215 <div class="col-md-1 text-right cell-default"> 0216 <span><?= $product['num_downloads'] ?></span> 0217 </div> 0218 <div class="col-md-1 text-right cell-default"> 0219 <span><?= $product['dl_pling_factor'] ?></span> 0220 </div> 0221 0222 <?php /* 0223 <div class="col-md-2 text-right cell-default"> 0224 <span><?= $product['num_downloads'] * $product['dl_pling_factor'] ?></span> 0225 </div> */ ?> 0226 <div class="col-md-1 text-right cell-default"> 0227 <span> 0228 <?php 0229 $errorMsg = "<ul>"; 0230 $showErrMsg = false; 0231 0232 if($isCurrentMonth) { 0233 if($product['is_license_missing_now'] == 1) { 0234 $errorMsg .= "<li>Please specify a License</li>"; 0235 $showErrMsg = true; 0236 } 0237 if($product['is_source_missing_now'] == 1) { 0238 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0239 $showErrMsg = true; 0240 } 0241 if($product['is_pling_excluded_now'] == 1) { 0242 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0243 $showErrMsg = true; 0244 } 0245 $sum_plings = $product['num_plings_now']; 0246 } else { 0247 if($product['is_license_missing'] == 1) { 0248 $errorMsg .= "<li>License was not specified</li>"; 0249 $showErrMsg = true; 0250 } 0251 if($product['is_source_missing'] == 1) { 0252 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0253 $showErrMsg = true; 0254 } 0255 if($product['is_pling_excluded'] == 1) { 0256 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0257 $showErrMsg = true; 0258 } 0259 $sum_plings = $product['num_plings']; 0260 0261 } 0262 $errorMsg .= "</ul>"; 0263 0264 if($showErrMsg) { 0265 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>'; 0266 } else { 0267 print($currency->toCurrency($product['num_downloads'] * $product['dl_pling_factor'] / 100)); 0268 } 0269 ?> 0270 </span> 0271 0272 </div> 0273 0274 <?php 0275 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0276 ?> 0277 <div class="col-md-1 text-right cell-default"> 0278 <span><?= round($product['laplace_score'],2) ?></span> 0279 </div> 0280 <div class="col-md-1 text-right cell-default"> 0281 <span><?php print($currency->toCurrency( ($product['num_downloads'] * $product['dl_pling_factor'] / 100) * $product['laplace_score'])); ?></span> 0282 </div> 0283 <?php 0284 } 0285 ?> 0286 0287 <div class="col-md-1 text-right cell-default"> 0288 <?php 0289 $show_plings_sum = $sum_plings; 0290 if(!$sum_plings) { 0291 $show_plings_sum = '-'; 0292 } 0293 ?> 0294 <span style="color: #BBB"><?= $show_plings_sum ?></span> 0295 </div> 0296 <div class="col-md-1 text-right cell-default"> 0297 <?php if(!$showErrMsg) { 0298 $payout_sum = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0299 $payout_sum_new = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0300 $show_payout_sum = $payout_sum; 0301 $show_payout_new_sum = $payout_sum_new; 0302 0303 if($sum_plings && $sum_plings < $payout_sum) { 0304 $show_payout_new_sum = $sum_plings; 0305 $payout_sum_new = $sum_plings; 0306 } 0307 if($sum_plings && $sum_plings>0) { 0308 $show_payout_new_sum = $show_payout_new_sum ; 0309 0310 } else { 0311 $show_payout_new_sum = $payout_sum_new; 0312 } 0313 ?> 0314 <span style="color: #BBB"><?= $currency->toCurrency($show_payout_new_sum) ?></span> 0315 <?php } else { ?> 0316 <span> </span> 0317 <?php } ?> 0318 0319 </div> 0320 0321 </div> 0322 <?php 0323 $sum_total_month_score += ($product['num_downloads'] * $product['dl_pling_factor'] / 100) * $product['laplace_score']; 0324 $sum_total_payout_score = $currency->toCurrency($sum_total_month_score); 0325 if(!$showErrMsg) { 0326 $sum_total_month += $payout_sum; 0327 $sum_total_payout = $currency->toCurrency($sum_total_month); 0328 $sum_total_month_new += $show_payout_new_sum; 0329 $sum_total_payout_new = $currency->toCurrency($sum_total_month_new); 0330 } 0331 0332 $sum_total_text = 'Possible payout for this month (<span style="font-size: smaller;">*</span>):'; 0333 0334 $payout_success = false; 0335 if ($product['status'] == Default_Model_DbTable_MemberPayout::$PAYOUT_STATUS_COMPLETED) { 0336 $payout_success = true; 0337 $sum_total_payout_success = $currency->toCurrency($product['amount']); 0338 $sum_total_text_success = 'Actually successfully paid amount: '; 0339 } 0340 $has_paypal = $product['paypal_mail'] ? true : false; 0341 } 0342 0343 $sum_total_month_view = number_format($sum_total_month); 0344 ?> 0345 <div class='row row-total'> 0346 <?php 0347 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0348 ?> 0349 <div class='col-md-6 text-right'><?=$sum_total_text?></div> 0350 <?php 0351 } else { 0352 ?> 0353 <div class='col-md-8 text-right'><?=$sum_total_text?></div> 0354 <?php 0355 } 0356 ?> 0357 0358 <div class='col-md-1 text-right'><strong style="color: green;"><?=$sum_total_payout?></strong></div> 0359 0360 <?php 0361 if(Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin') { 0362 ?> 0363 <div class='col-md-1 text-right'></div> 0364 <div class='col-md-1 text-right'><strong><?=$sum_total_payout_score?></strong></div> 0365 <?php 0366 } 0367 ?> 0368 <div class='col-md-1 text-right'></div> 0369 <div class='col-md-1 text-right'><strong style="color: #BBB"><?=$sum_total_payout_new?></strong></div> 0370 0371 </div> 0372 0373 0374 0375 <?php 0376 0377 0378 $currentDate = date("Ym",time()); 0379 $viewDate = $month.""; 0380 $paypalWarning = ''; 0381 if($currentDate == $viewDate) { 0382 $member = $this->view_member; 0383 if(!isset($member['paypal_mail']) || $member['paypal_mail'] == '') { 0384 $has_paypal = false; 0385 $paypalWarning = 'You have no PayPal account configured. Please go to your settings page <a href="/settings#form-payment-panel">here</a>.'; 0386 } else { 0387 $has_paypal = true; 0388 } 0389 } else { 0390 $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>.'; 0391 } 0392 if (false == $has_paypal) { 0393 echo '<div class="alert alert-danger" role="alert">'.$paypalWarning.'</div>'; 0394 } 0395 0396 if (($sum_total_month/100) < 1) { 0397 echo '<div class="alert alert-warning" role="alert">We only pay out money if the total sum is over $1.</div>'; 0398 } 0399 ?> 0400 0401 </div> 0402 <?php 0403 } 0404 } else { 0405 0406 echo '<div class="tab-pane fade in active" id="'.$printDate.'">'; 0407 echo ' <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-12 cell-default">No Data</div></div>'; 0408 echo ' <div class="row row-total">'; 0409 echo ' <div class="col-md-11 text-right">Possible payout for this month (<span style="font-size: smaller;">*</span>):</div><div class="col-md-1 text-right"><strong>$0.00</strong></div>'; 0410 echo ' </div>'; 0411 echo '</div>'; 0412 } 0413 0414 0415 ?> 0416 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0417 <p>(**) The Payout is planned to become active on May 2019.</p> 0418 </div> 0419 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0420 <p>(*) Info:</p><p>This service will become active on May, 1st 2017. All previous months are shown for internal testing only. </p> 0421 <p>This service is considered Beta until othwise announced.</p> 0422 <br> 0423 <p>TOS:</p> 0424 <p>This payout service is completely voluntarily. It is within Hive01's full rights to decide at any time:</p> 0425 <p>a) when and</p> 0426 <p>b) how much of the shown calculated amount is to be paid or</p> 0427 <p>c) to cancel partly or complete payment without giving any reasons (reasons are most likely cheating or inflating download numbers).</p> 0428 <p>d) Any PLING-FACTOR can be changed at any time and any rate (even to "0") to adjust the payout amount for products, even for a previous still to-be-paid-out pending month as long as it has not been paid out yet.</p> 0429 <p><br>All products require a valid license. Certain products also require a link to an online source repository, like e.g. cgit.kde.org or github. If we find those requirements are set in a misleading way, we reserve the right to exclude the product or user temporarily or completely from receiving plings at any time. </p> 0430 <p><br>A valid PayPal address must be maintained in your settings at the time of the payout. 0431 The total payout amount for a completed month must be at least one dollar. 0432 Lesser amounts will not be paid out and can not be transferred to the next month. 0433 If you do not meet these requirements, we can not pay you out anything that month. 0434 Non-paid-out months will not be retroactively paid out in the future. 0435 We will check these requirements every month. 0436 Downloads are counted of all files during that month, be it active or inactive. 0437 If all requirements were met and we have no reasons to decide otherwise you will likely be receiving the payout amount to your PayPal account within the following month.</p> 0438 0439 </div> 0440 </div> 0441 0442 <script> 0443 $('#payout_info').click(function (event ) { 0444 event.preventDefault(); 0445 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0446 }); 0447 0448 $('.close').click(function () { 0449 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0450 }); 0451 0452 $(function(){ 0453 // Enables popover 0454 $(".payout-popover-info").popover({ 0455 html : true, 0456 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>' 0457 }); 0458 $(".payout-popover-warning").popover({ 0459 html : true, 0460 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>' 0461 }); 0462 $(".payout-popover-success").popover({ 0463 html : true, 0464 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>' 0465 }); 0466 $(".payout-popover-danger").popover({ 0467 html : true, 0468 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>' 0469 }); 0470 $(".msg-popover-danger").popover({ 0471 html : true, 0472 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>' 0473 }); 0474 }); 0475 0476 </script> 0477 0478 <?php $this->inlineScript()->appendScript( 0479 ' $(document).ready(function(){ 0480 $(\'[data-toggle="popover"]\').popover(); 0481 }); 0482 ');