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 $project_id = null;
0070 
0071 if(isset($this->project_id)) {
0072     $project_id = $this->project_id;
0073 }
0074 
0075 $modelTag = new Default_Model_Tags();
0076 $isOriginal = $modelTag->isProductOriginal($project_id);
0077 $isModification = $modelTag->isProductModification($project_id);
0078 
0079 $origialFactor = 0.1;
0080 
0081 ?>
0082 
0083 <div class="tab-content">
0084 <?php
0085 $helperUserRole = new Backend_View_Helper_UserRole();
0086 $userRoleName = $helperUserRole->userRole();
0087 
0088 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0089 $helpImage = new Default_View_Helper_Image();
0090 $css_active = ' in active';
0091 $has_paypal = false;
0092 $currency = new Zend_Currency('en_US');
0093 
0094 $currentDate = date("Ym",time());
0095 $printCurrentMonth = new DateTime($currentDate.'01');
0096 
0097 $printMonth = new DateTime($yearmonth.'01');
0098 $printDate = $printMonth->format('M Y');
0099 
0100 
0101 $allDownloads = $modelDownload->getUserDownloadsAndViewsForProject($this->member->member_id, $yearmonth, $section_id, $project_id);
0102 
0103 $modelProj = new Default_Model_Project();
0104 $isNoClone = $modelProj->isProjectClone($project_id) == false;
0105 
0106 $countDownloadsOverall = count($allDownloads);
0107 
0108 if ($countDownloadsOverall > 0) {
0109         $sum_total_credits = 0;
0110         ?>
0111     
0112         <div class="container-fluid margin-bottom-12" style="padding-left: 0; padding-right: 0;">
0113             <div class="row">
0114                 <div class="col-md-2 text-left text-uppercase nowrap" style="white-space: nowrap; "><strong>Type</strong></div>
0115                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Count</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Count Downloads/Mediaviews" data-trigger="hover" data-html="true" data-content="Sum of all valid Downloads and Mediaviews of any product (active or archived) within this month.</a>"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div>
0116                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Category-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Category-Factor" data-trigger="hover" data-html="true" data-content="The Category-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>
0117                 <div class="col-md-2 text-right text-uppercase nowrap" style="white-space: nowrap;min-width: 140px;max-width: 180px; "><strong>Original-Factor</strong><div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="Original-Factor" data-trigger="hover" data-html="true" data-content="If this product is a Original the factor is 1.0, if this product is a Modification the factor is 0.5, the default factor is 0.25"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span></div></div>
0118                 <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>
0119             </div>
0120         </div>
0121     
0122         <div class="tab-pane fade <?=$css_active?>" id="affiliate_<?=$firstProduct['yearmonth']?>">
0123             <?php
0124             $css_active = '';
0125 
0126             foreach ($allDownloads as $product) { 
0127                 $origialFactor = $product['org_factor'];
0128             ?>
0129                 <div class="row margin-bottom-12"  style="padding-left: 0; padding-right: 0; margin-bottom: 10px;">
0130                     <div class="col-md-2 text-left cell-default">
0131                         Downloads
0132                     </div>
0133                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0134                         <span><?= round($product['num_downloads_micropayout'],0) ?></span>
0135                     </div>
0136                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0137                         <span><?= $product['category_pling_factor'] ?></span>
0138                     </div>
0139                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0140                         <span>
0141                             <?php 
0142                             echo $origialFactor;
0143                             ?>
0144                         </span>
0145                     </div>
0146 
0147                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0148                         <span>
0149                         <?php 
0150                             $sum_credits = 0;
0151                             $sum_credits = $product['num_downloads_micropayout']*$product['category_pling_factor'];
0152                             $sum_credits = $sum_credits * $origialFactor;
0153                             print(round($sum_credits,2));
0154                             $sum_total_credits += round($sum_credits,2);
0155                         ?>
0156                         </span>
0157                         
0158                     </div>
0159                 </div>
0160 
0161 
0162                 <div class="row margin-bottom-12"  style="padding-left: 0; padding-right: 0; margin-bottom: 10px;">
0163                     <div class="col-md-2 text-left cell-default">
0164                         Mediaviews
0165                     </div>
0166                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0167                         <span><?= round($product['num_views_micropayout'],0) ?></span>
0168                     </div>
0169                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0170                         <span><?= $product['category_pling_factor'] ?></span>
0171                     </div>
0172                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0173                         <span>
0174                             <?php 
0175                             echo $origialFactor;
0176                             ?>
0177                         </span>
0178                     </div>
0179                     <div class="col-md-2 text-right cell-default" style="min-width: 140px;max-width: 180px;">
0180                         <span>
0181                         <?php 
0182                             $sum_credits = 0;
0183                             $sum_credits = $product['num_views_micropayout']*$product['category_pling_factor'];
0184                             $sum_credits = $sum_credits * $origialFactor;
0185                             print(round($sum_credits,2));
0186                             $sum_total_credits += round($sum_credits,2);
0187                         ?>
0188                         </span>
0189                     </div>
0190                 </div>
0191             
0192             <?php } ?>
0193             
0194             <div class='row row-total'>
0195                 <div class='col-md-2 text-right'></div>
0196                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;">Summaries:</div>
0197                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"></div>
0198                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"></div>
0199                 <div class='col-md-2 text-right' style="min-width: 140px;max-width: 180px;"><strong><?=$sum_total_credits?></strong></div>
0200             </div>
0201             
0202             
0203             
0204             <?php 
0205 
0206 
0207             //$currentDate = date("Ym",time());
0208             //$viewDate = $firstProduct['yearmonth']."";
0209 ?>
0210             
0211         </div>
0212 <?php
0213 } else {
0214     
0215     echo '<div class="tab-pane fade in active" id="'.$printDate.'">';
0216     echo '    <div style="text-align: center;" class="row margin-bottom-12"><div class="col-md-8 cell-default">No Data</div></div>';
0217     echo '    <div class="row row-total">';
0218     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>';
0219     echo '    </div>';
0220     echo '</div>';
0221 }
0222     
0223     
0224 ?>
0225 
0226 </div>    
0227