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 margin-left: 0px; 0035 margin-right: 0px; 0036 } 0037 0038 .popover { 0039 min-width:350px; 0040 } 0041 0042 .popover-title { 0043 text-transform: none; 0044 font-size: 11pt; 0045 } 0046 0047 .popover-content { 0048 text-transform: none; 0049 font-size: 11pt; 0050 } 0051 </style> 0052 <ul class="nav nav-tabs margin-bottom-10"> 0053 <?php 0054 0055 $isCurrentMonth = false; 0056 $modelDownload = new Default_Model_StatDownload(); 0057 $yearmonth = null; 0058 0059 if(isset($this->yearmonth)) { 0060 $yearmonth = $this->yearmonth; 0061 } 0062 0063 $section_id = null; 0064 0065 if(isset($this->section_id)) { 0066 $section_id = $this->section_id; 0067 } 0068 0069 ?> 0070 0071 <div class="tab-content"> 0072 <?php 0073 $helperUserRole = new Backend_View_Helper_UserRole(); 0074 $userRoleName = $helperUserRole->userRole(); 0075 0076 $modelTag = new Default_Model_Tags(); 0077 0078 $origialFactor = 0; 0079 0080 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0081 $helpImage = new Default_View_Helper_Image(); 0082 $css_active = ' in active'; 0083 $has_paypal = false; 0084 $currency = new Zend_Currency('en_US'); 0085 0086 $currentDate = date("Ym",time()); 0087 $printCurrentMonth = new DateTime($currentDate.'01'); 0088 0089 $printMonth = new DateTime($yearmonth.'01'); 0090 $printDate = $printMonth->format('M Y'); 0091 0092 0093 if(null != $section_id) { 0094 $allDownloads = $modelDownload->getUserDownloadsAndViewsForMonthAndSection($this->member->member_id, $yearmonth, $section_id); 0095 } else { 0096 $allDownloads = $modelDownload->getUserDownloadsAndViewsForMonth($this->member->member_id, $yearmonth); 0097 } 0098 0099 $countDownloadsOverall = count($allDownloads); 0100 0101 if ($countDownloadsOverall > 0) { 0102 $firstProduct = $allDownloads[0]; 0103 if ($firstProduct) { 0104 $printMonth = new DateTime($firstProduct['yearmonth'].'01'); 0105 $printCurrentMonth = new DateTime($currentDate.'01'); 0106 0107 if($printMonth == $printCurrentMonth) { 0108 $isCurrentMonth = true; 0109 } else { 0110 $isCurrentMonth = false; 0111 } 0112 $sum_total_month_score = 0; 0113 $sum_total_month = 0; 0114 $sum_total_month_uk = 0; 0115 $sum_total_month_uk_org = 0; 0116 $sum_total_month_new = 0; 0117 $sum_total_text = ''; 0118 $sum_total_payout = 0; 0119 $sum_total_payout_uk = 0; 0120 $sum_total_payout_uk_org = 0; 0121 $sum_total_payout_new = 0; 0122 0123 $sum_total_credits = 0; 0124 $sum_total_credits_org = 0; 0125 0126 $sum_total_month_potential_payout = 0; 0127 $sum_total_potential_payout = 0; 0128 0129 ?> 0130 0131 <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;"> 0132 <div class="row"> 0133 <div class="col-md-1" style="min-width: 150px;"></div> 0134 <div class="col-md-2 text-left text-uppercase nowrap" style="white-space: nowrap; "><strong>Products</strong></div> 0135 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Download-Credits</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Downloads-Credits" data-trigger="hover" data-html="true" data-content="Sum of all valid Download-Credits of any product (active or archived) within this month mulitplied by its Pling-Factor (see <a href='/faq-pling'>Pling-FAQ).</a>"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0136 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Mediaview-Credits</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Mediaview-Credits" data-trigger="hover" data-html="true" data-content="Sum of all valid Mediaview-Credits of any product (active or archived) within this month mulitplied by its Pling-Factor (see <a href='/faq-pling'>Pling-FAQ)."><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div> 0137 <?php /*<div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Credit-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Credit-Factor" data-trigger="hover" data-html="true" data-content="The Credit-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>*/?> 0138 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Sum Credits</strong></div> 0139 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Sum Payout</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Sum Payout" 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> 0140 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0141 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong style="color: #BBB">Max Payout (A)</strong></div> 0142 <?php endif;?> 0143 </div> 0144 </div> 0145 0146 <div class="tab-pane fade <?=$css_active?>" id="affiliate_<?=$firstProduct['yearmonth']?>"> 0147 <?php 0148 $css_active = ''; 0149 0150 foreach ($allDownloads as $product) { 0151 $section_factor = $product['section_payout_factor']; 0152 $actual_payout_sum = $product['amount_section_micropayout']; 0153 $origialFactor = $product['org_factor']; 0154 0155 ?> 0156 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;"> 0157 <div class="col-md-1 cell-default" style=""> 0158 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0159 <img src="<?php echo $helpImage->Image($product['image_small'], array('width' => 80, 'height' => 65)); ?> " height="81" width="101"/> 0160 </a> 0161 </div> 0162 <div class="col-md-2 text-left cell-default"> 0163 <?php if(Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { ?> 0164 <a href="/member/<?= $this->member->member_id ?>/sectioncreditsmonthajax?yearmonth=<?= $product['yearmonth'] ?>§ion_id=<?= $product['section_id'] ?>&project_id=<?= $product['project_id'] ?>" data-toggle="creditdetailajax" data-target="#credit-tab-content-<?= $product['yearmonth'] ?>-<?= $product['project_id'] ?>" id="sec_<?= $product['yearmonth'] ?>-<?= $product['project_id'] ?>"> 0165 <span style="line-height: 3em;"><?= $product['title']; ?></span> 0166 </a> 0167 <?php } else { ?> 0168 <a href="<?= $this->buildProductUrl($product['project_id']) ?>"> 0169 <span style="line-height: 3em;"><?= $product['title']; ?></span> 0170 </a> 0171 <?php } ?> 0172 <b style="display: block; margin-bottom: 5px; font-size: 10pt; line-height: 0em;min-width: 140px;max-width: 180px;"><?=$product['cat_title']?></b> 0173 </div> 0174 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0175 <span><?= round($product['num_downloads_micropayout']*$product['category_pling_factor'],0) ?> 0176 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0177 (<?= round($product['num_downloads_micropayout']*$product['category_pling_factor']*$origialFactor,2) ?>) 0178 <?php endif; ?> 0179 </span> 0180 </div> 0181 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0182 <span><?= round($product['num_views_micropayout']*$product['category_pling_factor'],0) ?> 0183 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0184 (<?= round($product['num_views_micropayout']*$product['category_pling_factor']*$origialFactor,2) ?>) 0185 <?php endif; ?> 0186 </span> 0187 </div> 0188 <?php /* 0189 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0190 <span><?= $product['category_pling_factor'] ?></span> 0191 </div> 0192 * 0193 */?> 0194 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0195 <span> 0196 <?php 0197 $errorMsg = "<ul>"; 0198 $showErrMsg = false; 0199 0200 if($isCurrentMonth) { 0201 if($product['is_license_missing_now'] == 1) { 0202 $errorMsg .= "<li>Please specify a License</li>"; 0203 $showErrMsg = true; 0204 } 0205 if($product['is_source_missing_now'] == 1) { 0206 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0207 $showErrMsg = true; 0208 } 0209 if($product['is_pling_excluded_now'] == 1) { 0210 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0211 $showErrMsg = true; 0212 } 0213 $sum_plings = $product['num_plings_now']; 0214 } else { 0215 if($product['is_license_missing'] == 1) { 0216 $errorMsg .= "<li>License was not specified</li>"; 0217 $showErrMsg = true; 0218 } 0219 if($product['is_source_missing'] == 1) { 0220 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0221 $showErrMsg = true; 0222 } 0223 if($product['is_pling_excluded'] == 1) { 0224 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0225 $showErrMsg = true; 0226 } 0227 0228 0229 } 0230 $errorMsg .= "</ul>"; 0231 0232 if($showErrMsg) { 0233 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>'; 0234 } else { 0235 print(round($product['num_plings_micropayout'],0)); 0236 0237 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { 0238 print(' ('.round($product['num_plings_micropayout']*$origialFactor,2).')'); 0239 $sum_total_credits_org += round($product['num_plings_micropayout']*$origialFactor,2); 0240 } 0241 $sum_total_credits += round($product['num_plings_micropayout'],0); 0242 0243 0244 0245 } 0246 ?> 0247 </span> 0248 0249 </div> 0250 0251 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0252 <span> 0253 <?php 0254 $errorMsg = "<ul>"; 0255 $showErrMsg = false; 0256 0257 if($isCurrentMonth) { 0258 if($product['is_license_missing_now'] == 1) { 0259 $errorMsg .= "<li>Please specify a License</li>"; 0260 $showErrMsg = true; 0261 } 0262 if($product['is_source_missing_now'] == 1) { 0263 $errorMsg .= "<li>Please specify a link to the online source repository</li>"; 0264 $showErrMsg = true; 0265 } 0266 if($product['is_pling_excluded_now'] == 1) { 0267 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0268 $showErrMsg = true; 0269 } 0270 } else { 0271 if($product['is_license_missing'] == 1) { 0272 $errorMsg .= "<li>License was not specified</li>"; 0273 $showErrMsg = true; 0274 } 0275 if($product['is_source_missing'] == 1) { 0276 $errorMsg .= "<li>Link to the online source repository was not specified</li>"; 0277 $showErrMsg = true; 0278 } 0279 if($product['is_pling_excluded'] == 1) { 0280 $errorMsg .= "<li>This Product has been excluded from plings</li>"; 0281 $showErrMsg = true; 0282 } 0283 } 0284 $errorMsg .= "</ul>"; 0285 0286 if($showErrMsg) { 0287 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>'; 0288 } else { 0289 print($currency->toCurrency($product['num_plings_micropayout']/100)); 0290 0291 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { 0292 print(' ('.round($product['num_plings_micropayout']*$origialFactor/100,2).')'); 0293 } 0294 } 0295 ?> 0296 </span> 0297 0298 </div> 0299 0300 0301 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0302 <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;"> 0303 <span style="color: #BBB"><?php print($currency->toCurrency($product['amount_plings_micropayout'])); ?> (<?php print($currency->toCurrency($product['amount_plings_micropayout']*$origialFactor)); ?>) 0304 0305 </span> 0306 </div> 0307 <?php endif;?> 0308 <?php if(!$showErrMsg) { 0309 $payout_sum_uk = 0; 0310 $payout_sum_uk = $product['num_plings_micropayout']/100; 0311 0312 $payout_sum_uk_org = 0; 0313 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) { 0314 $payout_sum_uk_org = $product['num_plings_micropayout']*$origialFactor/100; 0315 } 0316 0317 ?> 0318 <?php } ?> 0319 </div> 0320 0321 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 10px;padding-left: 80px;font-size: small;"> 0322 <div class="col-md-1 text-right cell-default"></div> 0323 <div class="col-md-11 text-right cell-default"> 0324 <div id="credit-tab-content-<?= $product['yearmonth'] ?>-<?= $product['project_id'] ?>" class="hidden"></div> 0325 </div> 0326 0327 </div> 0328 0329 <?php 0330 $sum_total_month_potential_payout += $product['amount_plings_micropayout']; 0331 $sum_total_potential_payout = $currency->toCurrency($sum_total_month_potential_payout); 0332 0333 if(!$showErrMsg) { 0334 $sum_total_month_uk += $payout_sum_uk; 0335 $sum_total_payout_uk = $currency->toCurrency($sum_total_month_uk); 0336 0337 $sum_total_month_uk_org += $payout_sum_uk_org; 0338 $sum_total_payout_uk_org = $currency->toCurrency($sum_total_month_uk_org); 0339 } 0340 0341 $sum_total_text = 'Summaries:'; 0342 0343 $payout_success = false; 0344 if ($product['status'] == Default_Model_DbTable_MemberPayout::$PAYOUT_STATUS_COMPLETED) { 0345 $payout_success = true; 0346 $sum_total_payout_success = $currency->toCurrency($product['amount']); 0347 $sum_total_text_success = 'Actually successfully paid amount: '; 0348 } 0349 $has_paypal = $product['paypal_mail'] ? true : false; 0350 } 0351 0352 ?> 0353 <div class='row row-total'> 0354 <div class="col-md-1"></div> 0355 <div class='col-md-2 text-right'></div> 0356 <?php /*<div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"></div> */ ?> 0357 <div class='col-md-4 text-right' style="min-width: 340px;max-width: 340px;margin-right: 13px;">Summaries:</div> 0358 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"> 0359 <strong><?=$sum_total_credits?> 0360 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0361 (<?=$sum_total_credits_org?>) 0362 <?php endif;?> 0363 </strong> 0364 </div> 0365 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"> 0366 <strong><?=$sum_total_payout_uk?> 0367 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0368 (<?=$sum_total_payout_uk_org?>) 0369 <?php endif;?> 0370 </strong> 0371 </div> 0372 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0373 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"><strong style="color: #BBB"><?=$sum_total_potential_payout?></strong></div> 0374 <?php endif;?> 0375 </div> 0376 0377 0378 0379 <?php 0380 0381 0382 $currentDate = date("Ym",time()); 0383 $viewDate = $firstProduct['yearmonth'].""; 0384 ?> 0385 0386 </div> 0387 <?php 0388 } 0389 } else { 0390 0391 echo '<div class="tab-pane fade in active" id="'.$printDate.'">'; 0392 echo ' <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>'; 0393 echo ' <div class="row row-total">'; 0394 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>'; 0395 echo ' </div>'; 0396 echo '</div>'; 0397 } 0398 0399 0400 ?> 0401 0402 </div> 0403 0404 <script> 0405 $(document).ready(function(){ 0406 $('[data-toggle="creditdetailajax"]').click(function(e) { 0407 var $this = $(this), 0408 loadurl = $this.attr('href'), 0409 targ = $this.attr('data-target'); 0410 0411 if($(targ).hasClass('hidden')) { 0412 $(targ).html('<i class="fa fa-spinner"></i>'); 0413 $(targ).removeClass('hidden'); 0414 $(targ).addClass('shown'); 0415 0416 $.get(loadurl, function(data) { 0417 $(targ).html(data); 0418 }); 0419 } else { 0420 $(targ).removeClass('shown'); 0421 $(targ).addClass('hidden'); 0422 } 0423 0424 0425 return false; 0426 }); 0427 0428 }); 0429 </script> 0430