File indexing completed on 2025-05-04 05:29:31
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 $this->tab = 'payout'; 0024 $this->countDownloadsOverall = 0; 0025 0026 $currentDate = date("Ym",time()); 0027 $currentYear = date("Y",time()); 0028 0029 $modelDownload = new Default_Model_StatDownload(); 0030 $downloadYears = $modelDownload->getUserDownloadYears($this->member->member_id); 0031 #$this->countDownloadsOverall = count($this->downloads); 0032 ?> 0033 0034 0035 <main class="user-admin-page"> 0036 <?php echo $this->render('user/partials/userHeader_top.phtml'); ?> 0037 <section class="body-wrap"> 0038 <section class="wrapper product-page"> 0039 <!-- PAGE BODY --> 0040 <section class="my-products-page"> 0041 <!-- NAVIGATION --> 0042 <?php echo $this->render('user/partials/userHeader.phtml'); ?> 0043 <!-- /NAVIGATION --> 0044 <div class="my-products-heading" style="border-bottom: none; padding-bottom: 0px;"> 0045 <h1 class="page-title left"><?= $this->translate('Payout') ?></h1> 0046 <?php 0047 $member = $this->view_member; 0048 if($member->pling_excluded == 1) { 0049 echo "<br><br><br><h1 style='color: red; '>This account has been excluded from receiving plings, due to various misuses.</h1>"; 0050 } 0051 ?> 0052 </div> 0053 0054 <!-- year tabs nav --> 0055 <div class="pling-nav-tabs" style="padding-bottom: 20px;"> 0056 <ul class="nav nav-tabs" id="yeartablist"> 0057 <?php 0058 if(count($downloadYears) == 0 || $downloadYears[0]['year'] != $currentYear) { 0059 //Current year 0060 echo '<li role="presentation" class="yeartabs">'; 0061 echo ' <a style="font-size: 18px;" data-year="'.$currentYear.'" data-toggle="yeartabajax" href="/member/'.$member->member_id.'/plingsajax?year='.$currentYear.'" data-target="#my-payout-list" id="tab_year_'.$currentYear.'">'.$currentYear.'</a>'; 0062 echo '</li>'; 0063 } 0064 0065 foreach ($downloadYears as $yearobj) { 0066 echo '<li role="presentation" class="yeartabs">'; 0067 echo ' <a style="font-size: 18px;" data-year="'.$yearobj['year'].'" data-toggle="yeartabajax" href="/member/'. $member->member_id.'/plingsajax?year='.$yearobj['year'].'" data-target="#my-payout-list" id="tab_year_'.$yearobj['year'].'">'.$yearobj['year'].'</a>'; 0068 echo '</li>'; 0069 } 0070 ?> 0071 </ul> 0072 </div> 0073 <section> 0074 <?php 0075 $member = $this->view_member; 0076 if($member->paypal_valid_status > 100) { 0077 $status = $this->paypal_valid_status; 0078 if($status->color == 'red') { 0079 echo '<div class="alert alert-danger" role="alert">'.$status->description.'</div>'; 0080 } 0081 if($status->color == 'yellow') { 0082 echo '<div class="alert alert-warning" role="alert">'.$status->description.'</div>'; 0083 } 0084 if($status->color == 'blue') { 0085 echo '<div class="alert alert-info" role="alert">'.$status->description.'</div>'; 0086 } 0087 if($status->color == 'green') { 0088 echo '<div class="alert alert-success" role="alert">'.$status->description.'</div>'; 0089 } 0090 } 0091 ?> 0092 </section> 0093 0094 <?php 0095 if($member->pling_excluded == 0 || (Zend_Auth::getInstance()->hasIdentity() AND Zend_Auth::getInstance()->getIdentity()->roleName == 'admin')) { 0096 echo "<script>"; 0097 echo "var yearList = new Array();"; 0098 0099 if(count($downloadYears) == 0 || $downloadYears[0]['year'] != $currentYear) { 0100 //Current year 0101 echo "var yearListObj = new Array();"; 0102 echo "yearListObj['maxMonth'] = '".$currentDate."';"; 0103 echo "yearListObj['sum'] = '0';"; 0104 echo "yearList['".$currentYear."'] = yearListObj;"; 0105 } 0106 0107 foreach ($downloadYears as $yearobj) { 0108 echo "var yearListObj = new Array();"; 0109 echo "yearListObj['maxMonth'] = '".$yearobj['max_yearmonth']."';"; 0110 echo "yearListObj['sum'] = '".$yearobj['sum_amount']."';"; 0111 echo "yearList['".$yearobj['year']."'] = yearListObj;"; 0112 } 0113 echo "</script>"; 0114 ?> 0115 <div class="my-products-list" id="my-payout-list"> 0116 <div id="plingsyear"> 0117 <i class="fa fa-spinner"></i> 0118 </div> 0119 </div> 0120 <?php 0121 } 0122 ?> 0123 </section> 0124 <!-- /PAGE BODY --> 0125 </section> 0126 </section> 0127 </main> 0128 0129 <script> 0130 $(document).ready(function(){ 0131 0132 0133 //Load pling for year 0134 $('[data-toggle="yeartabajax"]').click(function(e) { 0135 0136 var $this = $(this); 0137 var year = $this.attr('data-year'); 0138 var loadurl = $this.attr('href'); 0139 var targ = $('#plingsyear'); 0140 0141 $('.yeartabs').removeClass('active'); 0142 $this.parent().addClass('active'); 0143 0144 $(targ).html('<i class="fa fa-spinner"></i>'); 0145 0146 $.get(loadurl, function(data) { 0147 0148 $('#plingsyear').html(data); 0149 $('[data-toggle="popover"]').popover(); 0150 0151 0152 //Init tabs 0153 $('[data-toggle="tabajax"]').click(function(e) { 0154 var $this = $(this), 0155 loadurl = $this.attr('href'), 0156 targ = $this.attr('data-target'); 0157 $(targ).html('<i class="fa fa-spinner"></i>'); 0158 0159 $.get(loadurl, function(data) { 0160 $(targ).html(data); 0161 }); 0162 0163 $this.tab('show'); 0164 return false; 0165 }); 0166 0167 //Load first Tab 0168 var month = yearList[year]['maxMonth']; 0169 var $this = $('#tab_'+month), 0170 loadurl = $this.attr('href'), 0171 targ = $this.attr('data-target'); 0172 0173 $.get(loadurl, function(data) { 0174 $(targ).html(data); 0175 }); 0176 0177 $this.tab('show'); 0178 0179 }); 0180 0181 $(targ).show(); 0182 return false; 0183 }); 0184 0185 //Init View on first load 0186 var year = <?= $currentYear ?>; 0187 var currentyeartab = $('#tab_year_'+year); 0188 $('.yeartabs').removeClass('active'); 0189 0190 currentyeartab.parent().addClass('active'); 0191 0192 var loadurl = currentyeartab.attr('href'); 0193 $.get(loadurl, function(data) { 0194 $('#plingsyear').html(data); 0195 $('[data-toggle="popover"]').popover(); 0196 0197 0198 //Init tabs 0199 $('[data-toggle="tabajax"]').click(function(e) { 0200 var $this = $(this), 0201 loadurl = $this.attr('href'), 0202 targ = $this.attr('data-target'); 0203 $(targ).html('<i class="fa fa-spinner"></i>'); 0204 0205 $.get(loadurl, function(data) { 0206 $(targ).html(data); 0207 }); 0208 0209 $this.tab('show'); 0210 return false; 0211 }); 0212 0213 0214 var $this = $('#tab_' + yearList[year]['maxMonth']), 0215 loadurl = $this.attr('href'), 0216 targ = $this.attr('data-target'); 0217 0218 $.get(loadurl, function(data) { 0219 $(targ).html(data); 0220 }); 0221 0222 $this.tab('show'); 0223 0224 0225 return false; 0226 }); 0227 0228 0229 $('[data-toggle="tabajax"]').click(function(e) { 0230 0231 var $this = $(this), 0232 loadurl = $this.attr('href'), 0233 targ = $this.attr('data-target'); 0234 $(targ).html('<i class="fa fa-spinner"></i>'); 0235 0236 $.get(loadurl, function(data) { 0237 $(targ).html(data); 0238 }); 0239 0240 $this.tab('show'); 0241 return false; 0242 }); 0243 0244 }); 0245 0246 $('#payout_info').click(function (event ) { 0247 event.preventDefault(); 0248 $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem 0249 }); 0250 0251 $('.close').click(function () { 0252 $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem 0253 }); 0254 0255 $(function(){ 0256 // Enables popover 0257 $(".payout-popover-info").popover({ 0258 html : true, 0259 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>' 0260 }); 0261 $(".payout-popover-warning").popover({ 0262 html : true, 0263 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>' 0264 }); 0265 $(".payout-popover-success").popover({ 0266 html : true, 0267 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>' 0268 }); 0269 $(".payout-popover-danger").popover({ 0270 html : true, 0271 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>' 0272 }); 0273 $(".msg-popover-danger").popover({ 0274 html : true, 0275 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>' 0276 }); 0277 }); 0278 0279 </script>