File indexing completed on 2024-12-29 05:24:39
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 // product detail pling single project button 0024 $plings = new Default_Model_DbTable_ProjectPlings(); 0025 $cntplings = $plings->getPlingsAmount($this->project_id); 0026 0027 $isPlinged = false; 0028 $member_id = null; 0029 $isSupporter = false; 0030 if($this->authMember){ 0031 $member_id = $this->authMember->member_id; 0032 $tmp = $plings->getPling($this->project_id,$member_id); 0033 if($tmp) 0034 { 0035 $isPlinged = true; 0036 } 0037 $isSupporter = $this->isSupporter($member_id); 0038 } 0039 0040 $heartatt = ''; 0041 $urlUserFollows = $this->buildProductUrl($this->project_id, 'plingproject'); 0042 0043 $heartatt = $heartatt. 'role="button" data-fragment="" ' 0044 .' data-target="#container-pling'.$this->project_id.'"' 0045 .' data-href="'.$urlUserFollows.'"' 0046 .' data-issupporter="'.$isSupporter.'"' 0047 .' data-auth="'.$member_id.'"'; 0048 $out ='<div role="button" class="partialbuttonplingproject" '.$heartatt.' style="display:block; float:right">'; 0049 0050 if($cntplings==0) 0051 { 0052 $out = $out. '<div class="plingbartext"><span class="plingnum"> Pling </span> </div>'; 0053 } 0054 else 0055 { 0056 $out = $out. '<div class="plingbartext"><span class="plingnum"> '.$cntplings.' Plings</span> </div>'; 0057 } 0058 0059 0060 if ($isPlinged){ 0061 $out = $out.'<img id="plingbtn" data-src="/images/system/pling-btn-active.png" src="/images/system/pling-btn-active.png"/>'; 0062 }else{ 0063 $out = $out.'<img id="plingbtn" data-src="/images/system/pling-btn-normal.png" src="/images/system/pling-btn-normal.png"/>'; 0064 } 0065 0066 $out = $out.'</div>'; 0067 0068 echo $out; 0069 /** 0070 0071 $pmodel = new Default_Model_DbTable_ProjectPlings(); 0072 $soll = $this->getCurrentMonthPlings($this->ppload_collection_id, $this->project_category_id); 0073 $pling = $cntplings; 0074 $score = 0; 0075 $left = 0; 0076 $right = 0; 0077 $plingcolor = '#EE6E09'; 0078 $is_f = 0; 0079 $poshtml = ''; 0080 if($soll > $pling){ 0081 $is_f = 1; 0082 $score = 100; 0083 $left=100; 0084 $right = 0; 0085 if($soll == 0) 0086 { 0087 $rightlinepos = 0; 0088 }else{ 0089 $rightlinepos = $pling*200/$soll; 0090 } 0091 0092 $poshtml = '<div class="progress-bar" style="background-color:#fff; width:2px; position:relative; left:'.$rightlinepos.'px "></div>'; 0093 }else{ 0094 $is_f = 0; 0095 if($pling==0){ 0096 $score = 1; 0097 }else 0098 { 0099 $score = $soll/$pling; 0100 } 0101 0102 $left = $score*100; 0103 $right = 100-$left; 0104 } 0105 0106 $solltxt = number_format($soll,2,'.',''); 0107 $sollhtml = ' <div class="amountsoll" style="width:50px; padding-right:5px;text-align:right;">$'.$solltxt.'</div>'; 0108 $out = $out.'<div style="display:flex;clear:both">'.$sollhtml.'<div class="plingbar" style="flex:1;padding-top:4px"> 0109 <div class="progress" style="height: 12px; width: 200px;padding:2px;background-color: transparent; box-shadow: none;"> 0110 <div class="progress-bar" style="background-color: '.$plingcolor.';width: '.$left.'%;"> '.$poshtml.' </div> 0111 <div class="progress-bar" style="background-color: #eeeeee;width: '.$right.'%;"> </div> 0112 </div></div></div>'; 0113 0114 0115 0116 0117 0118 0119 **/ 0120 0121 ?> 0122 0123 <style type="text/css"> 0124 0125 0126 div.plingbartext{ 0127 padding-right: 15px; 0128 float: left; 0129 padding-top: 6px; 0130 0131 } 0132 0133 </style>