File indexing completed on 2025-05-04 05:29:29

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 <ul class="nav nav-tabs well">
0024     <?php
0025     $bufferDate = '';
0026     $yearlyDonations = null;
0027     $allDonations = array();
0028     $active = 'active';
0029     foreach ($this->donations as $donation) {
0030         $currentYear = $donation->year;
0031         if ($currentYear != $bufferDate) {
0032             $bufferDate = $currentYear;
0033             $yearlyDonations = array();
0034             ?>
0035         <li class="<?= $active ?>"><a href="#<?= $donation->year ?>" data-toggle="tab"><?= $donation->year ?></a>
0036             </li><?php
0037         }
0038         $yearlyDonations[] = $donation;
0039         $allDonations[$currentYear] = $yearlyDonations;
0040         $active = '';
0041     } ?>
0042 </ul>
0043 
0044 <div class="tab-content" id="my-earnings-tabs">
0045     <?php
0046     $index = 0;
0047     $currency = new Zend_Currency();
0048     $active = 'active';
0049     foreach ($allDonations as $year => $yearlyDonations) {
0050         $sumAmount = 0;
0051         $sumCount = 0;
0052         ?>
0053         <div class="tab-pane <?= $active ?>" id="<?= $year ?>">
0054             <div class="row margin-left-0 margin-right-0">
0055                 <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
0056                     <h3 class="lightblue product-title">Month</h3>
0057                 </div>
0058                 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
0059                     <h3 class="lightblue product-title">Amount</h3>
0060                 </div>
0061                 <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
0062                     <h3 class="lightblue product-title">Number</h3>
0063                 </div>
0064             </div><?php
0065 
0066             $active = '';
0067             foreach ($yearlyDonations as $donation) {
0068                 $currency->setValue($donation->amount);
0069                 $currentYear = $donation->year;
0070                 $printMonth = strftime('%b', mktime(0, 0, 0, $donation->month));
0071                 $index++;
0072                 $sumAmount += $donation->amount;
0073                 $sumCount += $donation->count;
0074 
0075                 ?>
0076             <div class="row margin-left-0 margin-right-0" id="<?= $index ?>">
0077                 <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
0078                     <h3><?= $donation->year . '-' . $printMonth ?></h3>
0079                 </div>
0080                 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
0081                     <h3><?= $currency->toString() ?></h3>
0082                 </div>
0083                 <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
0084                     <h3><?= $donation->count ?></h3>
0085                 </div>
0086                 </div><?php
0087 
0088             }
0089             $currency->setValue($sumAmount);
0090 
0091             ?>
0092             <div class="row bg-primary margin-left-0 margin-right-0" id="0">
0093                 <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
0094                     <h3>Totals: </h3>
0095                 </div>
0096                 <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
0097                     <h3><?= $currency->toString() ?></h3>
0098                 </div>
0099                 <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
0100                     <h3><?= $sumCount ?></h3>
0101                 </div>
0102             </div>
0103         </div>
0104     <?php } ?>
0105 </div>