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 = 'payoutsection';
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->getUserDownloadsAndViewsYears($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.'/sectionsajax?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.'/sectionsajax?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                 
0165                 return false;
0166             });
0167             
0168             //Load first Tab
0169             var month = yearList[year]['maxMonth'];
0170             var $this = $('#tab_'+month),
0171             loadurl = $this.attr('href'),
0172             targ = $this.attr('data-target');
0173 
0174             $.get(loadurl, function(data) {
0175                 $(targ).html(data);
0176             });
0177 
0178             $this.tab('show');
0179             
0180         });
0181 
0182         $(targ).show();
0183         return false;
0184     });
0185          
0186     //Init View on first load     
0187     var year = <?= $currentYear ?>;
0188     var currentyeartab = $('#tab_year_'+year);
0189     $('.yeartabs').removeClass('active');
0190     
0191     currentyeartab.parent().addClass('active');
0192     
0193     var loadurl = currentyeartab.attr('href');
0194     $.get(loadurl, function(data) {
0195         $('#plingsyear').html(data);
0196         $('[data-toggle="popover"]').popover();
0197         
0198         
0199         //Init tabs
0200         $('[data-toggle="tabajax"]').click(function(e) {
0201             var $this = $(this),
0202                 loadurl = $this.attr('href'),
0203                 targ = $this.attr('data-target');
0204             $(targ).html('<i class="fa fa-spinner"></i>');
0205 
0206             $.get(loadurl, function(data) {
0207                 $(targ).html(data);
0208             });
0209 
0210             $this.tab('show');
0211             return false;
0212         });
0213         
0214         
0215         var $this = $('#tab_' + yearList[year]['maxMonth']),
0216             loadurl = $this.attr('href'),
0217             targ = $this.attr('data-target');
0218 
0219         $.get(loadurl, function(data) {
0220             $(targ).html(data);
0221         });
0222 
0223         $this.tab('show');
0224         
0225 
0226         return false;
0227     });
0228     
0229     
0230     $('[data-toggle="tabajax"]').click(function(e) {
0231                
0232         var $this = $(this),
0233             loadurl = $this.attr('href'),
0234             targ = $this.attr('data-target');
0235         $(targ).html('<i class="fa fa-spinner"></i>');
0236 
0237         $.get(loadurl, function(data) {
0238             $(targ).html(data);
0239         });
0240 
0241         $this.tab('show');
0242         return false;
0243     });
0244             
0245 });
0246 
0247     $('#payout_info').click(function (event ) {
0248         event.preventDefault();
0249         $('#le-alert').addClass('in'); // shows alert with Bootstrap CSS3 implem
0250     });
0251 
0252     $('.close').click(function () {
0253         $(this).parent().removeClass('in'); // hides alert with Bootstrap CSS3 implem
0254     });
0255     
0256     $(function(){
0257         // Enables popover
0258         $(".payout-popover-info").popover({
0259             html : true,
0260             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>'
0261         });
0262         $(".payout-popover-warning").popover({
0263             html : true,
0264             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>'
0265         });
0266         $(".payout-popover-success").popover({
0267             html : true,
0268             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>'
0269         });
0270         $(".payout-popover-danger").popover({
0271             html : true,
0272             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>'
0273         });
0274         $(".msg-popover-danger").popover({
0275             html : true,
0276             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>'
0277         });
0278     });
0279 
0280 </script>