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 $helperUserRole = new Backend_View_Helper_UserRole();
0024 $userRoleName = $helperUserRole->userRole();
0025 
0026 $isForAdmin = (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName);
0027 
0028 $this->tab = 'payout';
0029 $this->countDownloadsOverall = 0;
0030 
0031 $currentDate = date("Ym",time());
0032 $currentYear = date("Y",time());
0033 
0034 $modelDownload = new Default_Model_Section();
0035 $downloadYears = $modelDownload->getAllDownloadYears($isForAdmin);
0036 #$this->countDownloadsOverall = count($this->downloads);
0037 
0038 $config = Zend_Registry::get('config')->settings->client->default;
0039 $baseurlStore = $config->baseurl_store;
0040 ?>
0041 
0042 
0043 <main class="user-admin-page">
0044     <section class="body-wrap">
0045         <section class="wrapper product-page">
0046             <!-- PAGE BODY -->
0047             <section class="my-products-page">
0048                 <div class="my-products-heading" style="border-bottom: none; padding-bottom: 0px;">
0049                     <h1 class="page-title left"><?= $this->translate('Public Funding') ?></h1>
0050                     <br><br><br><br><div>To support any section, click <a href="<?= $baseurlStore ?>/support">here</a>.</div>
0051                 </div>
0052                 
0053                 <!-- year tabs nav -->
0054                 <div class="pling-nav-tabs" style="padding-bottom: 20px;">
0055                     <ul class="nav nav-tabs" id="yeartablist">
0056                         <?php
0057                             if(count($downloadYears) == 0 ||  $downloadYears[0]['year'] != $currentYear) {
0058                                 //Current year
0059                                 echo '<li role="presentation" class="yeartabs">';
0060                                 echo '    <a style="font-size: 18px;" data-year="'.$currentYear.'" data-toggle="yeartabajax" href="/funding/plingsajax?year='.$currentYear.'" data-target="#my-payout-list" id="tab_year_'.$currentYear.'">'.$currentYear.'</a>';
0061                                 echo '</li>';
0062                             }
0063 
0064                             foreach ($downloadYears as $yearobj) {
0065                                 echo '<li role="presentation" class="yeartabs">';
0066                                 echo '    <a style="font-size: 18px;" data-year="'.$yearobj['year'].'" data-toggle="yeartabajax" href="/funding/plingsajax?year='.$yearobj['year'].'" data-target="#my-payout-list" id="tab_year_'.$yearobj['year'].'">'.$yearobj['year'].'</a>';
0067                                 echo '</li>';
0068                             }
0069                         ?>
0070                     </ul>
0071                 </div>
0072                 
0073                 <?php
0074                     echo "<script>";
0075                     echo "var yearList = new Array();";
0076 
0077                     if(count($downloadYears) == 0 ||  $downloadYears[0]['year'] != $currentYear) {
0078                         //Current year
0079                         echo "var yearListObj = new Array();";
0080                         echo "yearListObj['maxMonth'] = '".$currentDate."';";
0081                         echo "yearListObj['sum'] = '0';";
0082                         echo "yearList['".$currentYear."'] = yearListObj;";
0083                     }
0084 
0085                     foreach ($downloadYears as $yearobj) {
0086                         echo "var yearListObj = new Array();";
0087                         echo "yearListObj['maxMonth'] = '".$yearobj['max_yearmonth']."';";
0088                         echo "yearListObj['sum'] = '0';";
0089                         echo "yearList['".$yearobj['year']."'] = yearListObj;";
0090                     }
0091                     echo "</script>";
0092                 ?>  
0093                 <div class="my-products-list" id="my-payout-list">
0094                     <div id="plingsyear">
0095                         <i class="fa fa-spinner"></i>
0096                     </div>
0097                 </div>
0098             </section>
0099             <!-- /PAGE BODY -->
0100         </section>
0101     </section>
0102 </main>
0103 
0104 <script>
0105 $(document).ready(function(){
0106     
0107     
0108     //Load pling for year
0109     $('[data-toggle="yeartabajax"]').click(function(e) {
0110                
0111         var $this = $(this);
0112         var year = $this.attr('data-year');
0113         var loadurl = $this.attr('href');
0114         var targ = $('#plingsyear');
0115         
0116         $('.yeartabs').removeClass('active');
0117         $this.parent().addClass('active');
0118         
0119         $(targ).html('<i class="fa fa-spinner"></i>');
0120 
0121         $.get(loadurl, function(data) {
0122             
0123             $('#plingsyear').html(data);
0124             $('[data-toggle="popover"]').popover();
0125             
0126             
0127             //Init tabs
0128             $('[data-toggle="tabajax"]').click(function(e) {
0129                 var $this = $(this),
0130                     loadurl = $this.attr('href'),
0131                     targ = $this.attr('data-target');
0132                 $(targ).html('<i class="fa fa-spinner"></i>');
0133 
0134                 $.get(loadurl, function(data) {
0135                     $(targ).html(data);
0136                 });
0137 
0138                 $this.tab('show');
0139                 return false;
0140             });
0141             
0142             //Load first Tab
0143             var month = yearList[year]['maxMonth'];
0144             var $this = $('#tab_'+month),
0145             loadurl = $this.attr('href'),
0146             targ = $this.attr('data-target');
0147 
0148             $.get(loadurl, function(data) {
0149                 $(targ).html(data);
0150             });
0151 
0152             $this.tab('show');
0153             
0154         });
0155 
0156         $(targ).show();
0157         return false;
0158     });
0159          
0160     //Init View on first load     
0161     var year = <?= $currentYear ?>;
0162     var currentyeartab = $('#tab_year_'+year);
0163     $('.yeartabs').removeClass('active');
0164     
0165     currentyeartab.parent().addClass('active');
0166     
0167     var loadurl = currentyeartab.attr('href');
0168     $.get(loadurl, function(data) {
0169         $('#plingsyear').html(data);
0170         $('[data-toggle="popover"]').popover();
0171         
0172         
0173         //Init tabs
0174         $('[data-toggle="tabajax"]').click(function(e) {
0175             var $this = $(this),
0176                 loadurl = $this.attr('href'),
0177                 targ = $this.attr('data-target');
0178             $(targ).html('<i class="fa fa-spinner"></i>');
0179 
0180             $.get(loadurl, function(data) {
0181                 $(targ).html(data);
0182             });
0183 
0184             $this.tab('show');
0185             return false;
0186         });
0187         
0188         
0189         var $this = $('#tab_' + yearList[year]['maxMonth']),
0190             loadurl = $this.attr('href'),
0191             targ = $this.attr('data-target');
0192 
0193         $.get(loadurl, function(data) {
0194             $(targ).html(data);
0195         });
0196 
0197         $this.tab('show');
0198         
0199 
0200         return false;
0201     });
0202     
0203     
0204     $('[data-toggle="tabajax"]').click(function(e) {
0205                
0206         var $this = $(this),
0207             loadurl = $this.attr('href'),
0208             targ = $this.attr('data-target');
0209         $(targ).html('<i class="fa fa-spinner"></i>');
0210 
0211         $.get(loadurl, function(data) {
0212             $(targ).html(data);
0213         });
0214 
0215         $this.tab('show');
0216         return false;
0217     });
0218             
0219 });
0220 
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>