File indexing completed on 2025-05-04 05:29:21
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 .inline { 0026 display: inline-block; 0027 } 0028 0029 .cell-default { 0030 line-height: 2em; 0031 vertical-align: middle; 0032 } 0033 .row-total { 0034 border-top: #1595ee solid thin; 0035 padding-top: 1em; 0036 padding-bottom: 1em; 0037 line-height: 30px; 0038 } 0039 0040 .popover { 0041 min-width:350px; 0042 } 0043 0044 .popover-title { 0045 text-transform: none; 0046 font-size: 11pt; 0047 } 0048 0049 .popover-content { 0050 text-transform: none; 0051 font-size: 11pt; 0052 } 0053 </style> 0054 <ul class="nav nav-tabs margin-bottom-10"> 0055 <?php 0056 0057 $isCurrentMonth = false; 0058 $modelDownload = new Default_Model_Section(); 0059 $yearmonth = null; 0060 0061 if(isset($this->yearmonth)) { 0062 $yearmonth = $this->yearmonth; 0063 } 0064 0065 ?> 0066 0067 <div class="tab-content"> 0068 <?php 0069 $helperUserRole = new Backend_View_Helper_UserRole(); 0070 $userRoleName = $helperUserRole->userRole(); 0071 0072 $modelInfo = new Default_Model_Info(); 0073 0074 $isForAdmin = (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName); 0075 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 $allSections = $modelDownload->fetchAllSections(); 0087 $countDownloadsOverall = count($allSections); 0088 0089 $countIncome = 0; 0090 $countPayout = 0; 0091 $countPayout2 = 0; 0092 0093 if ($countDownloadsOverall > 0) { 0094 $firstProduct = $allSections[0]; 0095 if ($firstProduct) { 0096 $printMonth = new DateTime($yearmonth.'01'); 0097 $printCurrentMonth = new DateTime($currentDate.'01'); 0098 0099 if($printMonth == $printCurrentMonth) { 0100 $isCurrentMonth = true; 0101 } else { 0102 $isCurrentMonth = false; 0103 } 0104 0105 0106 ?> 0107 <div class="tab-pane fade <?=$css_active?>" id="<?=$yearmonth?>"> 0108 <?php 0109 $css_active = ''; 0110 0111 foreach ($allSections as $section) { 0112 $sectionStats = $modelDownload->fetchSectionStats($yearmonth, $section['section_id'], $isForAdmin); 0113 if(!$sectionStats) { 0114 $sectionStats = $modelDownload->fetchSectionSupportStats($yearmonth, $section['section_id'], $isForAdmin); 0115 } 0116 $supporters = $modelInfo->getNewActiveSupportersForSectionAndMonth($sectionStats['section_id'], $yearmonth); 0117 0118 ?> 0119 <div class="row margin-bottom-12" style="padding-left: 0; padding-right: 0; margin-bottom: 25px;"> 0120 0121 <div class="col-md-2 cell-default" style="" id="<?=$section['section_id']?>"><?=$section['name']?></div> 0122 <div class="col-md-1 text-right cell-default" style=""><?= $sectionStats['num_supporter'] ?></div> 0123 0124 <div class="col-md-1 text-right cell-default" style=""><strong><?php print($currency->toCurrency($sectionStats['sum_support'] + $sectionStats['sum_sponsor'])); ?></strong></div> 0125 <!--<div class="col-md-1 text-right cell-default" style=""><?=$sectionStats['sum_dls']?></div>--> 0126 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0127 <div class="col-md-1 text-right cell-default" style=""><?php print($currency->toCurrency($sectionStats['sum_amount']));?></div> 0128 <?php endif; ?> 0129 0130 0131 <!--<div class="col-md-1 text-right cell-default" style=""><?=$sectionStats['sum_dls_payout']?></div>--> 0132 <div class="col-md-1 text-right cell-default" style=""><strong><?php print($currency->toCurrency($sectionStats['sum_amount_payout']));?></strong></div> 0133 0134 <div class="col-md-1 text-right cell-default" style=""><strong><?php 0135 #if(($sectionStats['sum_support'] + $sectionStats['sum_sponsor']) < $sectionStats['sum_amount_payout']) { 0136 if(($sectionStats['sum_support'] + $sectionStats['sum_sponsor']) == 0 || $sectionStats['sum_amount_payout'] == 0) { 0137 echo "1.00"; 0138 } else { 0139 echo round(($sectionStats['sum_support'] + $sectionStats['sum_sponsor']) / $sectionStats['sum_amount_payout'], 2); 0140 } 0141 #} else { 0142 # echo "1.00"; 0143 #} 0144 ?></strong></div> 0145 0146 <?php /* 0147 <div class="col-md-1 text-right cell-default" style=""> 0148 <?php 0149 if($sectionStats['sum_support']>0 && $sectionStats['sum_amount']>0) { 0150 $percentFactor = ($sectionStats['sum_support'] + $sectionStats['sum_sponsor']) / $sectionStats['sum_amount'] * 100; 0151 } else { 0152 $percentFactor = 0; 0153 } 0154 if($percentFactor>100) { 0155 $percentFactor = 100; 0156 } 0157 0158 ?> 0159 <div style="height: 20px;border: 1px solid gray;width: 100px;padding: 0;margin: 0;"> 0160 <div style="padding: 0;margin: 0;background-color: green;height: 10px;width: <?= round($percentFactor, 2) ?>px;"></div> 0161 <div style="padding: 0;margin: 0;background-color: red;height: 10px;width: 100px;"></div> 0162 </div> 0163 0164 </div> 0165 * 0166 */?> 0167 <div class="col-md-4 text-left cell-default"> 0168 <div style=""> 0169 <?php 0170 $i=0; 0171 foreach ($supporters as $user) { 0172 ?> 0173 <div class="inline" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="" data-trigger="hover" data-html="true" data-content="This month <b><?= $user['username']?></b> supports this section with $<?= $user['sum_tier'] ?>." > 0174 <a href="<?php echo $this->buildMemberUrl($user['username']); ?>" class="tooltipuserleft" data-user="<?=$user['member_id']?>" data-amaount="<?=$user['sum_tier']?>"> 0175 <img height="25" width="25" src="<?php echo $this->Image($user['profile_image_url'], array('width' => '25', 'height' => '25', 'crop' => 2)); ?>" class="supporterx" /> 0176 </a> 0177 </div> 0178 <?php 0179 } 0180 ?> 0181 </div> 0182 </div> 0183 </div> 0184 <?php 0185 $countIncome += $sectionStats['sum_support'] + $sectionStats['sum_sponsor']; 0186 $countPayout += $sectionStats['sum_amount']; 0187 $countPayout2 += $sectionStats['sum_amount_payout']; 0188 } 0189 ?> 0190 <div class='row row-total'> 0191 <div class='col-md-2' style=""></div> 0192 <div class='col-md-1 text-right' style=""></div> 0193 <div class='col-md-1 text-right' style=""><strong><?php print($currency->toCurrency($countIncome)); ?></strong></div> 0194 <?php if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) : ?> 0195 <div class='col-md-1 text-right' style=""><?php print($currency->toCurrency($countPayout)); ?></div> 0196 <?php endif; ?> 0197 <!--<div class='col-md-1 text-right' style=""></div>--> 0198 <div class='col-md-1 text-right' style=""><strong><?php print($currency->toCurrency($countPayout2)); ?></strong></div> 0199 0200 <div class='col-md-1 text-right' style=""></div> 0201 <div class='col-md-1 text-right' style=""></div> 0202 0203 0204 </div> 0205 0206 </div> 0207 <?php 0208 } 0209 } 0210 ?> 0211 0212 </div> 0213 <script> 0214 $(document).ready(function(){ 0215 $('[data-toggle="popover"]').popover(); 0216 }); 0217 </script> 0218 0219 0220 <script> 0221 $('#payout_info').click(function (event ) { 0222 event.preventDefault(); 0223 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0224 }); 0225 0226 $('.close').click(function () { 0227 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0228 }); 0229 0230 </script> 0231