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

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     .cell-default {
0026         line-height: 4em;
0027         vertical-align: middle;
0028     }
0029     .popover {
0030         min-width:350px;
0031     }
0032     
0033     .row-total {
0034         border-top: #1595ee solid thin;
0035         padding-top: 1em;
0036         padding-bottom: 1em;
0037         line-height: 30px;
0038         margin-left: 0px;
0039         margin-right: 0px;
0040     }
0041     
0042     .popover-title { 
0043         text-transform: none;
0044         font-size: 11pt;
0045     }
0046     
0047     .popover-content { 
0048         text-transform: none;
0049         font-size: 11pt;
0050     }
0051 </style>
0052 
0053 <ul class="nav nav-tabs margin-bottom-10 tabs-up" id="plingtabs">
0054 <?php
0055 
0056 $helperUserRole = new Backend_View_Helper_UserRole();
0057 $userRoleName = $helperUserRole->userRole();
0058     
0059 $isCurrentMonth = false;
0060 $currentYear = date("Y",time());
0061 
0062 $member = $this->view_member;
0063 
0064 if($this->year) {
0065     $currentYear = $this->year;
0066 }
0067 
0068 
0069 $currentDate = date("Ym",time());
0070 $currentMonth = '';
0071 $monthlyDownload = null;
0072 $allDownloads = array();
0073 $css_active = 'active';
0074 
0075 $printCurrentMonth = new DateTime($currentDate.'01');
0076 
0077 $modelDownload = new Default_Model_StatDownload();
0078 $downloadMonths = $modelDownload->getUserDownloadsAndViewsMonths($this->member->member_id, $currentYear);
0079 $countDownloadsOverall = count($downloadMonths);
0080 $minDate = null;
0081 
0082 if ($countDownloadsOverall > 0) {  
0083     foreach ($downloadMonths as $download) {
0084         $printMonth = new DateTime($download['yearmonth'].'01');
0085         if($minDate == null) {
0086             $minDate = $download['yearmonth'];
0087         }
0088         
0089         $printDate = $printMonth->format('M Y');
0090         $printDateNow = $printCurrentMonth->format('M Y');
0091         
0092         if($printDateNow == $printDate) {
0093             $printDate = 'Current month';
0094             $isCurrentMonth = true;
0095         } else {
0096             $isCurrentMonth = false;
0097         }
0098         
0099         if ($printDate != $currentMonth) {
0100             $monthlyDownload = array();
0101             $currentMonth = $printDate;
0102         
0103     ?>
0104     
0105     <?php   
0106         $showDiv = false;
0107         $infoTextLinkToPaypal = "";
0108         
0109         if(isset($download['payment_transaction_id'])) {
0110             $infoTextLinkToPaypal = ' Your PayPal TransactionId:'.$download['payment_transaction_id'].'.';
0111         }
0112         $payoutStatusTable = new Default_Model_DbTable_PayoutStatus();
0113         $payoutStatus = $payoutStatusTable->find($download['status'])->current();
0114         
0115         $infoTitle = $payoutStatus['title'];
0116         $infoText = $payoutStatus['description'];
0117         $infoIconStyle = "color: ".$payoutStatus['color']." ";
0118         $infoClass = $payoutStatus['type'];
0119         $infoIcon = $payoutStatus['icon'];
0120         
0121         $infoText .= $infoTextLinkToPaypal;
0122         
0123         $popover = "";
0124         if(isset($download['status']) && isset($infoText)) {
0125             $popover = '<div class="inline payout-popover-'.$infoClass.'" style="margin-left:.2em;" data-placement="top" data-toggle="popover" title="'.$infoTitle.'" data-trigger="hover" data-html="true" data-content="'.$infoText.'"><span style="'. $infoIconStyle .'" class="glyphicon '.$infoIcon.'" aria-hidden="true"></span></div>';
0126         }
0127     ?>
0128     
0129     <?php if($isCurrentMonth) {?>
0130     
0131     <li class="media_node span <?=$css_active?> ">
0132         <a href="/member/<?= $member->member_id ?>/sectionsmonthajax?yearmonth=<?= $download['yearmonth'] ?>" data-toggle="tabajax" data-target="#pling-tab-content" id="tab_<?= $download['yearmonth'] ?>"><?= $printDate ?><?= $popover ?></a>
0133     </li>
0134     
0135     <?php } else { ?>
0136     
0137     <li class="media_node span <?=$css_active?> ">
0138         <a href="/member/<?= $member->member_id ?>/sectionsmonthajax?yearmonth=<?= $download['yearmonth'] ?>" data-toggle="tabajax" data-target="#pling-tab-content" id="tab_<?= $download['yearmonth'] ?>"><?= $printDate ?><?= $popover ?></a>
0139     </li>
0140     
0141     <?php } ?>
0142     
0143     <?php
0144         }
0145         $css_active = '';
0146         $monthlyDownload[] = $download;
0147         $allDownloads[$download['yearmonth']] = $monthlyDownload;
0148     }
0149      
0150 } else {
0151     $currentMonth = '';
0152     $currentDate = date("Ym",time());
0153     $printMonth = new DateTime($currentDate.'01');
0154     
0155     $printDate = $printMonth->format('M Y');
0156     $printDate = 'Current month';
0157     
0158     $minDate = $currentDate;
0159     
0160     ?>
0161     <li class="in active">
0162         <a href="/member/<?= $member->member_id ?>/sectionsmonthajax?yearmonth=<?= $currentDate  ?>" data-toggle="tabajax" data-target="#pling-tab-content" id="tab_<?= $currentDate  ?>"><?= $printDate ?></a>
0163     </li>
0164 <?php
0165 }
0166 ?>
0167 </ul>
0168 
0169 
0170 
0171 
0172 <div class="tab-content" id="pling-tab-content"><i class="fa fa-spinner"></i></div>