File indexing completed on 2025-05-04 05:29:29
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)) { 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 0087 if(null != $section_id) { 0088 $allDownloads = $modelDownload->getUserDownloadsForMonthAndSection($this->member->member_id, $yearmonth, $section_id); 0089 } else { 0090 $allDownloads = $modelDownload->getUserDownloadsForMonth($this->member->member_id, $yearmonth); 0091 } 0092 0093 $countDownloadsOverall = count($allDownloads); 0094 0095 if ($countDownloadsOverall > 0) { 0096 $firstProduct = $allDownloads[0]; 0097 if ($firstProduct) { 0098 $printMonth = new DateTime($firstProduct['yearmonth'].'01'); 0099 $printCurrentMonth = new DateTime($currentDate.'01'); 0100 0101 if($printMonth == $printCurrentMonth) { 0102 $isCurrentMonth = true; 0103 } else { 0104 $isCurrentMonth = false; 0105 } 0106 $sum_total_month_score = 0; 0107 $sum_total_month = 0; 0108 $sum_total_month_uk = 0; 0109 $sum_total_month_new = 0; 0110 $sum_total_text = ''; 0111 $sum_total_payout = 0; 0112 $sum_total_payout_uk = 0; 0113 $sum_total_payout_new = 0; 0114 0115 $sum_total_month_potential_payout = 0; 0116 $sum_total_potential_payout = 0; 0117 0118 ?> 0119 <div class="tab-pane fade <?=$css_active?>" id="<?=$firstProduct['yearmonth']?>"> 0120 <?php 0121 $css_active = ''; 0122 0123 foreach ($allDownloads as $product) { ?> 0124 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0125 <div class="col-md-1 cell-default" style="min-width: 150px;"> 0126 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0127 <img src="<?php echo $helpImage->Image($product['image_small'], array('width' => 80, 'height' => 65)); ?> " height="81" width="101"/> 0128 </a> 0129 </div> 0130 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0131 <div class="col-md-2 text-left cell-default"> 0132 <?php else: ?> 0133 <div class="col-md-3 text-left cell-default"> 0134 <?php endif; ?> 0135 0136 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0137 <span style="line-height: 3em;"><?= $product['title']; ?></span> 0138 </a> 0139 <b style="display: block; margin-bottom: 5px; font-size: 10pt; line-height: 0em;"><?=$product['cat_title']?></b> 0140 </div> 0141 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0142 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0143 <?php if($product['num_downloads_nouk']>0) { ?> 0144 <span><?= $product['num_downloads_nouk'] ?></span> 0145 <?php } else { ?> 0146 <span><?= $product['num_downloads'] ?></span> 0147 <?php } ?> 0148 </div> 0149 <?php endif; ?> 0150 0151 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0152 <span><?= $product['num_downloads'] ?></span> 0153 </div> 0154 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0155 <span><?= $product['dl_pling_factor'] ?></span> 0156 </div> 0157 0158 0159 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0160 <span style="color: #BBB"><?php print($currency->toCurrency($product['num_downloads'] * $product['dl_pling_factor'] / 100)); ?></span> 0161 </div> 0162 0163 0164 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0165 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0166 <span><?= $product['section_payout_factor'] ?></span> 0167 </div> 0168 <?php endif; ?> 0169 0170 0171 0172 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0173 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0174 <span> 0175 <?php 0176 $errorMsg = "<ul>"; 0177 $showErrMsg = false; 0178 0179 if($isCurrentMonth) { 0180 if($product['is_license_missing_now'] == 1) { 0181 $errorMsg .= "<li>Please specify a License</li>"; 0182 $showErrMsg = true; 0183 } 0184 if($product['is_source_missing_now'] == 1) { 0185 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0186 $showErrMsg = true; 0187 } 0188 if($product['is_pling_excluded_now'] == 1) { 0189 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0190 $showErrMsg = true; 0191 } 0192 $sum_plings = $product['num_plings_now']; 0193 } else { 0194 if($product['is_license_missing'] == 1) { 0195 $errorMsg .= "<li>License was not specified</li>"; 0196 $showErrMsg = true; 0197 } 0198 if($product['is_source_missing'] == 1) { 0199 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0200 $showErrMsg = true; 0201 } 0202 if($product['is_pling_excluded'] == 1) { 0203 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0204 $showErrMsg = true; 0205 } 0206 $sum_plings = $product['num_plings']; 0207 0208 } 0209 $errorMsg .= "</ul>"; 0210 0211 if($showErrMsg) { 0212 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>'; 0213 } else { 0214 0215 if($product['num_downloads_nouk']>0) { 0216 print($currency->toCurrency($product['num_downloads_nouk'] * $product['dl_pling_factor'] / 100)); 0217 } else { 0218 print($currency->toCurrency($product['num_downloads'] * $product['dl_pling_factor'] / 100)); 0219 } 0220 } 0221 ?> 0222 </span> 0223 </div> 0224 <?php endif; ?> 0225 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0226 <span> 0227 <?php 0228 $errorMsg = "<ul>"; 0229 $showErrMsg = false; 0230 0231 if($isCurrentMonth) { 0232 if($product['is_license_missing_now'] == 1) { 0233 $errorMsg .= "<li>Please specify a License</li>"; 0234 $showErrMsg = true; 0235 } 0236 if($product['is_source_missing_now'] == 1) { 0237 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0238 $showErrMsg = true; 0239 } 0240 if($product['is_pling_excluded_now'] == 1) { 0241 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0242 $showErrMsg = true; 0243 } 0244 $sum_plings = $product['num_plings_now']; 0245 } else { 0246 if($product['is_license_missing'] == 1) { 0247 $errorMsg .= "<li>License was not specified</li>"; 0248 $showErrMsg = true; 0249 } 0250 if($product['is_source_missing'] == 1) { 0251 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0252 $showErrMsg = true; 0253 } 0254 if($product['is_pling_excluded'] == 1) { 0255 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0256 $showErrMsg = true; 0257 } 0258 $sum_plings = $product['num_plings']; 0259 0260 } 0261 $errorMsg .= "</ul>"; 0262 0263 if($showErrMsg) { 0264 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>'; 0265 } else { 0266 print($currency->toCurrency($product['num_downloads'] * $product['dl_pling_factor'] / 100)); 0267 } 0268 ?> 0269 </span> 0270 0271 </div> 0272 0273 <?php if(!$showErrMsg) { 0274 //$payout_sum = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0275 $payout_sum_uk = 0; 0276 $payout_sum_new = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0277 0278 $show_payout_new_sum = $payout_sum_new; 0279 0280 0281 if($product['num_downloads_nouk']>0) { 0282 $payout_sum = $product['num_downloads_nouk'] * $product['dl_pling_factor'] / 100; 0283 } else { 0284 $payout_sum = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0285 } 0286 $show_payout_sum = $payout_sum; 0287 0288 $payout_sum_uk = $product['num_downloads'] * $product['dl_pling_factor'] / 100; 0289 0290 if($sum_plings && $sum_plings < $payout_sum) { 0291 $show_payout_new_sum = $sum_plings; 0292 $payout_sum_new = $sum_plings; 0293 } 0294 if($sum_plings && $sum_plings>0) { 0295 $show_payout_new_sum = $show_payout_new_sum ; 0296 0297 } else { 0298 $show_payout_new_sum = $payout_sum_new; 0299 } 0300 ?> 0301 <?php } ?> 0302 </div> 0303 <?php 0304 $sum_total_month_score += ($product['num_downloads'] * $product['dl_pling_factor'] / 100) * $product['laplace_score']; 0305 $sum_total_payout_score = $currency->toCurrency($sum_total_month_score); 0306 0307 $sum_total_month_potential_payout += ($product['num_downloads'] * $product['dl_pling_factor'] / 100); 0308 $sum_total_potential_payout = $currency->toCurrency($sum_total_month_potential_payout); 0309 0310 if(!$showErrMsg) { 0311 $sum_total_month += $payout_sum; 0312 $sum_total_month_uk += $payout_sum_uk; 0313 $sum_total_payout = $currency->toCurrency($sum_total_month); 0314 $sum_total_payout_uk = $currency->toCurrency($sum_total_month_uk); 0315 $sum_total_month_new += $show_payout_new_sum; 0316 $sum_total_payout_new = $currency->toCurrency($sum_total_month_new); 0317 } 0318 0319 $sum_total_text = 'Possible payout for this month (<span style="font-size: smaller;">*</span>):'; 0320 0321 $payout_success = false; 0322 if ($product['status'] == Default_Model_DbTable_MemberPayout::$PAYOUT_STATUS_COMPLETED) { 0323 $payout_success = true; 0324 $sum_total_payout_success = $currency->toCurrency($product['amount']); 0325 $sum_total_text_success = 'Actually successfully paid amount: '; 0326 } 0327 $has_paypal = $product['paypal_mail'] ? true : false; 0328 } 0329 0330 $sum_total_month_view = number_format($sum_total_month); 0331 ?> 0332 <div class='row row-total'> 0333 <div class='col-md-1 text-right' style="min-width: 150px;"></div> 0334 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0335 <div class='col-md-2 text-right'></div> 0336 <?php else: ?> 0337 <div class='col-md-3 text-right'></div> 0338 <?php endif; ?> 0339 0340 <div class='col-md-4 text-right' style="min-width: 380px;"><?=$sum_total_text?></div> 0341 <div class='col-md-1 text-right' style="min-width: 170px;"><strong style="color: #BBB"><?=$sum_total_potential_payout?></strong></div> 0342 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0343 <div class='col-md-1 text-right' style="min-width: 190px;"></div> 0344 <?php endif; ?> 0345 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0346 <div class='col-md-1 text-right' style="min-width: 190px;"><strong><?=$sum_total_payout?>**</strong></div> 0347 <?php endif; ?> 0348 <div class='col-md-1 text-right' style="min-width: 190px;"><strong><?=$sum_total_payout_uk?>**</strong></div> 0349 </div> 0350 0351 0352 0353 <?php 0354 0355 0356 $currentDate = date("Ym",time()); 0357 $viewDate = $firstProduct['yearmonth'].""; 0358 $paypalWarning = ''; 0359 if($currentDate == $viewDate) { 0360 $member = $this->view_member; 0361 if(!isset($member['paypal_mail']) || $member['paypal_mail'] == '') { 0362 $has_paypal = false; 0363 $paypalWarning = 'You have no PayPal account configured. Please go to your settings page <a href="/settings#form-payment-panel">here</a>.'; 0364 } else { 0365 $has_paypal = true; 0366 } 0367 } else { 0368 $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>.'; 0369 } 0370 if (false == $has_paypal) { 0371 echo '<div class="alert alert-danger" role="alert">'.$paypalWarning.'</div>'; 0372 } 0373 0374 if (($sum_total_month/100) < 1) { 0375 echo '<div class="alert alert-warning" role="alert">We only pay out money if the total sum is over $1.</div>'; 0376 } 0377 ?> 0378 0379 </div> 0380 <?php 0381 } 0382 } else { 0383 0384 echo '<div class="tab-pane fade in active" id="'.$printDate.'">'; 0385 echo ' <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>'; 0386 echo ' <div class="row row-total">'; 0387 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>'; 0388 echo ' </div>'; 0389 echo '</div>'; 0390 } 0391 0392 0393 ?> 0394 0395 <?php /* 0396 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0397 <p>(**) The Payout is planned to become active on May 2019.</p> 0398 </div> 0399 */ ?> 0400 0401 <div id="le-alert" class="alert alert-warning alert-block" role="alert"> 0402 <p>(*) Info:</p> 0403 <p>This service will become active on May, 1st 2017. All previous months are shown for internal testing only. 0404 </p> 0405 <p>This service is considered Beta until otherwise announced.</p> 0406 <br> 0407 <p>For the full Terms of Service, please read here: <a href="/terms/payout">Payout T&C</a></p> 0408 <br><br> 0409 <p>**Paypal might deduct general fees and conversion rate from this sum.</p> 0410 0411 </div> 0412 </div> 0413 0414 <script> 0415 $('#payout_info').click(function (event ) { 0416 event.preventDefault(); 0417 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0418 }); 0419 0420 $('.close').click(function () { 0421 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0422 }); 0423 0424 $(function(){ 0425 // Enables popover 0426 $(".payout-popover-info").popover({ 0427 html : true, 0428 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>' 0429 }); 0430 $(".payout-popover-warning").popover({ 0431 html : true, 0432 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>' 0433 }); 0434 $(".payout-popover-success").popover({ 0435 html : true, 0436 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>' 0437 }); 0438 $(".payout-popover-danger").popover({ 0439 html : true, 0440 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>' 0441 }); 0442 $(".msg-popover-danger").popover({ 0443 html : true, 0444 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>' 0445 }); 0446 }); 0447 0448 </script> 0449 0450 <?php $this->inlineScript()->appendScript( 0451 ' $(document).ready(function(){ 0452 $(\'[data-toggle="popover"]\').popover(); 0453 }); 0454 ');