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 0030 .row-total { 0031 border-top: #1595ee solid thin; 0032 padding-top: 1em; 0033 padding-bottom: 1em; 0034 line-height: 30px; 0035 margin-left: 0px; 0036 margin-right: 0px; 0037 } 0038 0039 .popover { 0040 min-width:350px; 0041 } 0042 0043 .popover-title { 0044 text-transform: none; 0045 font-size: 11pt; 0046 } 0047 0048 .popover-content { 0049 text-transform: none; 0050 font-size: 11pt; 0051 } 0052 </style> 0053 <ul class="nav nav-tabs margin-bottom-10"> 0054 <?php 0055 0056 $isCurrentMonth = false; 0057 $modelDownload = new Default_Model_StatDownload(); 0058 $yearmonth = null; 0059 0060 if(isset($this->yearmonth)) { 0061 $yearmonth = $this->yearmonth; 0062 } 0063 0064 $helperUserRole = new Backend_View_Helper_UserRole(); 0065 $userRoleName = $helperUserRole->userRole(); 0066 0067 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0068 $helpImage = new Default_View_Helper_Image(); 0069 $css_active = ' in active'; 0070 $has_paypal = false; 0071 $currency = new Zend_Currency('en_US'); 0072 0073 $currentDate = date("Ym",time()); 0074 $printCurrentMonth = new DateTime($currentDate.'01'); 0075 0076 $printMonth = new DateTime($yearmonth.'01'); 0077 $printDate = $printMonth->format('M Y'); 0078 ?> 0079 0080 0081 <div class="tab-content"> 0082 0083 <h3>Affiliates</h3> 0084 <br> 0085 0086 <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;"> 0087 <div class="row"> 0088 <div class="col-md-2 text-left text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Status</strong></div> 0089 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Affiliates</strong></div> 0090 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Sum Donations</strong></div> 0091 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Percentage </strong></div> 0092 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Sum Payout</strong></div> 0093 </div> 0094 </div> 0095 0096 <?php 0097 0098 $sum_total_payout_affiliate = 0; 0099 0100 $allAffiliates = $modelDownload->getUserAffiliatesForMonth($this->member->member_id, $yearmonth); 0101 $countDownloadsOverall = count($allAffiliates); 0102 0103 if ($countDownloadsOverall > 0) { 0104 $firstProduct = $allAffiliates[0]; 0105 if ($firstProduct) { 0106 $printMonth = new DateTime($firstProduct['yearmonth'].'01'); 0107 $printCurrentMonth = new DateTime($currentDate.'01'); 0108 0109 if($printMonth == $printCurrentMonth) { 0110 $isCurrentMonth = true; 0111 } else { 0112 $isCurrentMonth = false; 0113 } 0114 $sum_total_text = ''; 0115 $sum_total_payout_affiliate = 0; 0116 0117 ?> 0118 <div class="tab-pane fade <?=$css_active?>" id="<?=$firstProduct['yearmonth']?>"> 0119 <?php 0120 $css_active = ''; 0121 0122 foreach ($allAffiliates as $section) { 0123 $sum_total_payout_affiliate += $section['sum_donations']*$section['affiliate_percent']; 0124 ?> 0125 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0126 <div class="col-md-2 text-left cell-default"> 0127 <a href="/member/<?= $this->member->member_id ?>/sectionaffiliatesmonthdetailajax?yearmonth=<?= $section['yearmonth'] ?>" data-toggle="sectiondetailajax" data-target="#affiliate-content-<?= $section['yearmonth'] ?>" id="sec_<?= $section['yearmonth'] ?>">Show/Hide</a> 0128 </div> 0129 0130 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0131 <span><?= $section['count_supporters'] ?></span> 0132 </div> 0133 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0134 <span><?php print($currency->toCurrency($section['sum_donations'])); ?></span> 0135 </div> 0136 0137 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0138 <span><?php print($section['affiliate_percent']); ?></span> 0139 </div> 0140 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0141 <span><?php print($currency->toCurrency($section['sum_donations']*$section['affiliate_percent'])); ?></span> 0142 </div> 0143 </div> 0144 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;padding-left: 80px;font-size: small;"> 0145 <div class="col-md-1 text-right cell-default"></div> 0146 <div class="col-md-11 text-right cell-default"> 0147 <div id="affiliate-content-<?= $section['yearmonth'] ?>" class="hidden"></div> 0148 </div> 0149 0150 </div> 0151 0152 0153 0154 <?php 0155 0156 0157 $sum_total_text = 'Possible Affiliates payout for this month (<span style="font-size: smaller;">*</span>):'; 0158 0159 } 0160 0161 ?> 0162 <div class='row row-total'> 0163 <div class='col-md-2 text-right' style="min-width: 503px;"><?=$sum_total_text?></div> 0164 <div class='col-md-1 text-right' style="min-width: 190px;"></div> 0165 <div class='col-md-1 text-right' style="min-width: 190px;"></div> 0166 <div class='col-md-1 text-right' style="min-width: 190px;"><strong><?php print($currency->toCurrency($sum_total_payout_affiliate)); ?>**</strong></div> 0167 </div> 0168 </div> 0169 <?php 0170 } 0171 } else { 0172 0173 echo '<div class="tab-pane fade in active" id="'.$printDate.'">'; 0174 echo ' <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>'; 0175 echo ' <div class="row row-total">'; 0176 echo ' <div class="col-md-2 text-right" style="min-width: 503px;">Possible Affiliates payout for this month (<span style="font-size: smaller;">*</span>):</div>' 0177 . '<div class="col-md-1 text-right" style="min-width: 190px;"></div>' 0178 . '<div class="col-md-1 text-right" style="min-width: 190px;"></div>' 0179 . '<div class="col-md-1 text-right" style="min-width: 190px;"><strong>$0.00</strong></div>'; 0180 echo ' </div>'; 0181 echo '</div>'; 0182 } 0183 ?> 0184 0185 0186 0187 0188 <br><br><br> 0189 0190 <h3>Downloads/Mediaviews</h3> 0191 <br> 0192 <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;"> 0193 <div class="row"> 0194 <div class="col-md-2 text-left text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Section</strong></div> 0195 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Products</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Products" data-trigger="hover" data-html="true" data-content="Number of products this month."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0196 <?php /*<div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Total Credits</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Total Credits" data-trigger="hover" data-html="true" data-content="Sum of all credits of all files (active or archived of this product within this month."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div>*/ ?> 0197 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong style="color: #BBB">Products Sum</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Products Sum" data-trigger="hover" data-html="true" data-content="Amount of all credits in US $."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0198 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0199 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong style="color: #BBB">Payout Original (A)</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Products Sum" data-trigger="hover" data-html="true" data-content="Amount of all credits in US $."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0200 <?php endif; ?> 0201 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0202 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong style="color: #BBB">Max Payout (A)</strong></div> 0203 <?php endif; ?> 0204 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>Section-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Section-Factor" data-trigger="hover" data-html="true" data-content="The Section-Factor depends on the funding. <br>A factor of '1' means:<br>Funding and payout are equal.<br>A factor < 1 means:<br>The section is underfunded.<br>A factor > 1 means:<br>The section is overfunded.<br>Until the month is complete this value shows an estimate."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0205 <div class="col-md-1 text-right text-uppercase nowrap" style="white-space: nowrap; min-width: 190px;"><strong>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="Sum based on Section-Factor."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0206 0207 </div> 0208 </div> 0209 0210 0211 0212 <?php 0213 0214 0215 $allDownloads = $modelDownload->getUserSectionsForDownloadAndViewsForMonth($this->member->member_id, $yearmonth); 0216 $countDownloadsOverall = count($allDownloads); 0217 0218 if ($countDownloadsOverall > 0) { 0219 $firstProduct = $allDownloads[0]; 0220 if ($firstProduct) { 0221 $printMonth = new DateTime($firstProduct['yearmonth'].'01'); 0222 $printCurrentMonth = new DateTime($currentDate.'01'); 0223 0224 if($printMonth == $printCurrentMonth) { 0225 $isCurrentMonth = true; 0226 } else { 0227 $isCurrentMonth = false; 0228 } 0229 $sum_total_month_score = 0; 0230 $sum_total_month = 0; 0231 $sum_total_month_uk = 0; 0232 $sum_total_month_new = 0; 0233 $sum_total_month_max = 0; 0234 $sum_total_text = ''; 0235 $sum_total_payout = 0; 0236 $sum_total_payout_max = 0; 0237 $sum_total_payout_uk = 0; 0238 $sum_total_payout_new = 0; 0239 0240 $sum_total_month_potential_payout = 0; 0241 $sum_total_potential_payout = 0; 0242 0243 $sum_total_month_potential_payout_org = 0; 0244 $sum_total_potential_payout_org = 0; 0245 0246 0247 $css_active = ' in active'; 0248 ?> 0249 <div class="tab-pane fade <?=$css_active?>" id="<?=$firstProduct['yearmonth']?>"> 0250 <?php 0251 $css_active = ''; 0252 0253 foreach ($allDownloads as $section) { 0254 $section_payout_factor = $section['section_payout_factor']; 0255 $num_real_credits_section = $section['num_real_credits_plings']; 0256 0257 if($isCurrentMonth) { 0258 $section_payout_factor = $section['now_section_payout_factor']; 0259 } 0260 $num_real_credits_section = $section['num_real_credits_plings']*$section_payout_factor; 0261 0262 ?> 0263 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0264 <div class="col-md-2 text-left cell-default"> 0265 <a href="/member/<?= $this->member->member_id ?>/sectionplingsmonthajax?yearmonth=<?= $section['yearmonth'] ?>§ion_id=<?= $section['section_id'] ?>" data-toggle="sectiondetailajax" data-target="#pling-tab-content-<?= $section['yearmonth'] ?>-<?= $section['section_id'] ?>" id="sec_<?= $section['yearmonth'] ?>"><?= $section['section_name'] ?></a> 0266 </div> 0267 0268 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0269 <span><?= $section['count_projects'] ?></span> 0270 </div> 0271 <?php /* 0272 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0273 <span><?= round($section['num_real_credits_plings'],0) ?></span> 0274 </div> 0275 */ ?> 0276 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0277 <span><?php print($currency->toCurrency($section['num_real_credits_plings']/100)); ?></span> 0278 </div> 0279 0280 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0281 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0282 <span><?php print($currency->toCurrency($section['num_real_credits_plings_org']/100)); ?></span> 0283 </div> 0284 <?php endif; ?> 0285 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0286 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0287 <span><?php print($currency->toCurrency($section['sum_amount_credits_plings'])); ?></span> 0288 </div> 0289 <?php endif; ?> 0290 0291 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0292 <span><?php print($section_payout_factor); ?></span> 0293 </div> 0294 <div class="col-md-1 text-right cell-default" style="min-width: 190px;"> 0295 <span><?php print($currency->toCurrency($num_real_credits_section/100)); ?></span> 0296 </div> 0297 </div> 0298 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;padding-left: 80px;font-size: small;"> 0299 <div class="col-md-1 text-right cell-default"></div> 0300 <div class="col-md-11 text-right cell-default"> 0301 <div id="pling-tab-content-<?= $section['yearmonth'] ?>-<?= $section['section_id'] ?>" class="hidden"></div> 0302 </div> 0303 0304 </div> 0305 0306 0307 0308 <?php 0309 0310 $payout_sum = $num_real_credits_section/100; 0311 $payout_sum_max = $section['sum_amount_credits_plings']; 0312 0313 $sum_total_month_potential_payout += ($section['num_real_credits_plings']/100); 0314 $sum_total_potential_payout = $currency->toCurrency($sum_total_month_potential_payout); 0315 0316 $sum_total_month_potential_payout_org += ($section['num_real_credits_plings_org']/100); 0317 $sum_total_potential_payout_org = $currency->toCurrency($sum_total_month_potential_payout_org); 0318 0319 $sum_total_month += $payout_sum; 0320 $sum_total_payout = $currency->toCurrency($sum_total_month); 0321 0322 $sum_total_month_max += $payout_sum_max; 0323 $sum_total_payout_max = $currency->toCurrency($sum_total_month_max); 0324 0325 $sum_total_text = 'Possible Downloads/Mediaviews payout for this month (<span style="font-size: smaller;">*</span>):'; 0326 0327 $payout_success = false; 0328 if ($section['payout_status'] == Default_Model_DbTable_MemberPayout::$PAYOUT_STATUS_COMPLETED) { 0329 $payout_success = true; 0330 $sum_total_payout_success = $currency->toCurrency($section['payout_amount']); 0331 $sum_total_text_success = 'Actually successfully paid amount: '; 0332 } 0333 $has_paypal = $section['paypal_mail'] ? true : false; 0334 } 0335 0336 $sum_total_month_view = number_format($sum_total_month); 0337 ?> 0338 <div class='row row-total'> 0339 <div class='col-md-2 text-right' style="min-width: 503px;"><?=$sum_total_text?></div> 0340 <div class='col-md-1 text-right' style="min-width: 170px;"><strong style="color: #BBB"><?=$sum_total_potential_payout?></strong></div> 0341 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0342 <div class='col-md-1 text-right' style="min-width: 190px;"><strong style="color: #BBB"><?=$sum_total_potential_payout_org?></strong></div> 0343 <div class='col-md-1 text-right' style="min-width: 190px;"><strong style="color: #BBB"><?=$sum_total_payout_max?></strong></div> 0344 <?php endif; ?> 0345 <div class='col-md-1 text-right' style="min-width: 190px;"></div> 0346 <div class='col-md-1 text-right' style="min-width: 190px;"><strong><?=$sum_total_payout?>**</strong></div> 0347 </div> 0348 0349 0350 0351 <?php 0352 0353 0354 $currentDate = date("Ym",time()); 0355 $viewDate = $firstProduct['yearmonth'].""; 0356 $paypalWarning = ''; 0357 if($currentDate == $viewDate) { 0358 $member = $this->view_member; 0359 if(!isset($member['paypal_mail']) || $member['paypal_mail'] == '') { 0360 $has_paypal = false; 0361 $paypalWarning = 'You have no PayPal account configured. Please go to your settings page <a href="/settings#form-payment-panel">here</a>.'; 0362 } else { 0363 $has_paypal = true; 0364 } 0365 } else { 0366 if(false == $has_paypal) { 0367 $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>.'; 0368 } 0369 } 0370 if (false == $has_paypal) { 0371 echo '<div class="alert alert-danger" role="alert">'.$paypalWarning.'</div>'; 0372 } 0373 0374 if (($sum_total_month+$sum_total_payout_affiliate) < 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 Downloads/Mediaviews 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 $(document).ready(function(){ 0416 0417 $('[data-toggle="popover"]').popover(); 0418 0419 $('[data-toggle="sectiondetailajax"]').click(function(e) { 0420 var $this = $(this), 0421 loadurl = $this.attr('href'), 0422 targ = $this.attr('data-target'); 0423 0424 if($(targ).hasClass('hidden')) { 0425 $(targ).html('<i class="fa fa-spinner"></i>'); 0426 $(targ).removeClass('hidden'); 0427 $(targ).addClass('shown'); 0428 0429 $.get(loadurl, function(data) { 0430 $(targ).html(data); 0431 }); 0432 } else { 0433 $(targ).removeClass('shown'); 0434 $(targ).addClass('hidden'); 0435 } 0436 0437 0438 return false; 0439 }); 0440 0441 0442 $('#payout_info').click(function (event ) { 0443 event.preventDefault(); 0444 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0445 }); 0446 0447 $('.close').click(function () { 0448 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0449 }); 0450 0451 $(function(){ 0452 // Enables popover 0453 $(".payout-popover-info").popover({ 0454 html : true, 0455 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>' 0456 }); 0457 $(".payout-popover-warning").popover({ 0458 html : true, 0459 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>' 0460 }); 0461 $(".payout-popover-success").popover({ 0462 html : true, 0463 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>' 0464 }); 0465 $(".payout-popover-danger").popover({ 0466 html : true, 0467 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>' 0468 }); 0469 $(".msg-popover-danger").popover({ 0470 html : true, 0471 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>' 0472 }); 0473 }); 0474 0475 }); 0476 0477 </script> 0478 0479 <?php $this->inlineScript()->appendScript( 0480 ' $(document).ready(function(){ 0481 $(\'[data-toggle="popover"]\').popover(); 0482 }); 0483 ');