File indexing completed on 2024-12-29 05:24:52
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 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl(); 0024 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl(); 0025 $helperServerUrl = new Zend_View_Helper_ServerUrl(); 0026 ?> 0027 <div id="pling-widget" style="background-color:{{colors.widgetBg}};"> 0028 0029 <div class="widget-header"> 0030 <h3 class="padding-both-5" style="color:{{colors.headline}};">{{text.headline}}</h3> 0031 </div> 0032 0033 <div class="widget-body" style="background-color:{{colors.widgetContent}};color:{{colors.text}};"> 0034 <form action="<?= $helperBuildProductUrl->buildProductUrl($this->project->project_id, 'pling') ?>" 0035 target="_blank"> 0036 0037 <div class="widget-text" style="">{{text.content}}</div> 0038 0039 <div class="donation-amount" data-ng-if="amounts.showDonationAmount && pProvider == true"> 0040 <div class="support-with"> 0041 <span>Support with</span> 0042 </div> 0043 <div class="donation-amount-number"> 0044 <span class="glyphicon glyphicon-usd"></span> 0045 <?php if (true === empty($this->project->paypal_mail) || true === empty($this->project->dwolla_id)) { 0046 $style = 'disabled'; 0047 } else { 0048 $style = ''; 0049 } 0050 ?> 0051 <input type="text" 0052 class="inp-pling <?php echo $style; ?>" 0053 data-ng-model="amounts.donation" 0054 name="amount"/> 0055 </div> 0056 <div class="button"> 0057 <button class="btn btn-pling" 0058 style="background-color:{{colors.button}};color:{{colors.buttonText}};" 0059 type="submit">{{text.button}} 0060 </button> 0061 </div> 0062 <?php if (false === empty($this->project->paypal_mail) || false === empty($this->project->dwolla_id)) { ?> 0063 <div class="payment-providers"> 0064 <div class="pay-with"> 0065 <span>Pay with</span> 0066 </div> 0067 <?php if (false === empty($this->project->paypal_mail)) { ?> 0068 <div class="input-group"> 0069 <span class="input-group-addon"> 0070 <input type="radio" name="provider" value="paypal" checked> 0071 </span> 0072 <span class="payment-icon"> 0073 <img src="/theme/flatui/img/logo_paypal.png"/> 0074 </span> 0075 </div> 0076 <?php } ?> 0077 <?php if (false === empty($this->project->dwolla_id)) { 0078 $checked = ''; 0079 if (empty($this->project->paypal_mail)) { 0080 $checked = 'checked'; 0081 } 0082 ?> 0083 <div class="input-group"> 0084 <span class="input-group-addon"> 0085 <input type="radio" name="provider" value="dwolla" <?= $checked ?>> 0086 </span> 0087 <span class="payment-icon"> 0088 <img src="/theme/flatui/img/new/dwolla.png"/> 0089 </span> 0090 </div> 0091 <?php } ?> 0092 </div> 0093 <?php } ?> 0094 </div> 0095 0096 <div class="product-funding-info" data-ng-if="pProvider == true" 0097 data-ng-class="{ 'with-goal' : amounts.goal}"> 0098 <div class="goal-range-number"> 0099 <span>$0</span> 0100 <span data-ng-if="amounts.goal">${{amounts.goal}}</span> 0101 <span class="unlimited" data-ng-if="!amounts.goal">∞</span> 0102 </div> 0103 <div class="achieved-amount"> 0104 <div class="bar" 0105 data-ng-class="{ 'no-goal' : !amounts.goal}" 0106 style="width:{{Math.round(100*amounts.current/amounts.goal)}}%"></div> 0107 </div> 0108 <div class="money-raised"><?= $this->translate('Raised') ?> ${{amounts.current}} <span 0109 data-ng-if="amounts.goal">of ${{amounts.goal}}</span></div> 0110 <div class="percentage" style="color:{{colors.widgetBg}};" data-ng-show="amounts.goal"> 0111 {{Math.round(100*amounts.current/amounts.goal)}}% 0112 </div> 0113 </div> 0114 0115 <div class="supporters" data-ng-if="showSupporters && pProvider == true" ng-hide="!supporters.length"> 0116 <div class="supporter has-tooltip" data-ng-repeat="supporter in supporters" 0117 title="{{supporter.username}}"> 0118 <a href="{{supporter.url}}"> 0119 <figure><img ng-src="{{supporter.img}}"/></figure> 0120 </a> 0121 </div> 0122 </div> 0123 0124 <div class="comments" data-ng-if="showComments && pProvider == true" ng-hide="!comments.length"> 0125 <div class="comment" data-ng-repeat="comment in comments"> 0126 <figure><img ng-src="{{comment.img}}"/></figure> 0127 <div class="content"> 0128 <div class="info">{{comment.username}} donated ${{comment.amount}}</div> 0129 <div class="text">{{comment.comment}}</div> 0130 </div> 0131 </div> 0132 </div> 0133 </form> 0134 </div> 0135 0136 <div class="widget-footer"> 0137 <div class="row"> 0138 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 padding-both-20"> 0139 <div class="pay-secure"> 0140 <a href="<?php echo $helperServerUrl->serverUrl() . $helperBuildProductUrl->buildProductUrl($this->project->project_id); ?>" 0141 target="_blank">visit on <?= $_SERVER['HTTP_HOST'] ?></a> 0142 </div> 0143 <div class="powered-by"> 0144 <a href="<?php echo $helperServerUrl->serverUrl() . $helperBuildProductUrl->buildProductUrl($this->project->project_id); ?>" 0145 target="_blank" class="opendesktop-logo {{logo}}"></a> 0146 </div> 0147 </div> 0148 </div> 0149 </div> 0150 0151 </div> 0152 0153 <?php 0154 $supportersArray = array(); 0155 foreach ($this->supporting as $supporter) { 0156 $new_supporter = new stdClass(); 0157 $new_supporter->username = $supporter->username; 0158 $new_supporter->img = $supporter->profile_image_url; 0159 $new_supporter->url = $helperBuildMemberUrl->buildMemberUrl($supporter->username, null, null, true); 0160 array_push($supportersArray, $new_supporter); 0161 } 0162 0163 $commentsArray = array(); 0164 foreach ($this->comments as $comment) { 0165 $new_comment = new stdClass(); 0166 $new_comment->username = $comment->username; 0167 $new_comment->img = $comment->profile_image_url; 0168 $new_comment->amount = $comment->amount; 0169 $new_comment->comment = $comment->comment; 0170 array_push($commentsArray, $new_comment); 0171 } 0172 ?> 0173 0174 <script type="text/javascript"> 0175 0176 var widgetApp = angular.module('widgetApp', ['colorpicker.module']); 0177 0178 widgetApp.controller('WidgetController', function ($scope, $http) { 0179 0180 $scope.Math = window.Math; 0181 0182 $scope.text = { 0183 content: "<?=addslashes($this->widgetConfig->text->content)?>", 0184 headline: "<?=addslashes($this->widgetConfig->text->headline)?>", 0185 button: "Pling it!" 0186 }; 0187 0188 $scope.amounts = { 0189 donation: '<?=$this->widgetConfig->amounts->donation?>', 0190 showDonationAmount:<?=$this->widgetConfig->amounts->showDonationAmount?'true':'false'?>, 0191 current: '<?=(float)$this->project->amount_received;?>', 0192 goal: '<?=false === empty($this->project->amount)?$this->project->amount:''; ?>' 0193 }; 0194 0195 $scope.colors = { 0196 widgetBg: '<?=$this->widgetConfig->colors->widgetBg?>', 0197 widgetContent: '<?=$this->widgetConfig->colors->widgetContent?>', 0198 headline: '<?=$this->widgetConfig->colors->headline?>', 0199 text: '<?=$this->widgetConfig->colors->text?>', 0200 button: '<?=$this->widgetConfig->colors->button?>', 0201 buttonText: '<?=$this->widgetConfig->colors->buttonText?>' 0202 }; 0203 0204 $scope.showSupporters = <?=$this->widgetConfig->showSupporters?'true':'false'?>; 0205 $scope.supporters = angular.fromJson('<?php echo json_encode($supportersArray);?>'); 0206 0207 $scope.showComments = <?=$this->widgetConfig->showComments?'true':'false'?>; 0208 $scope.comments = angular.fromJson('<?php echo addslashes(json_encode($commentsArray));?>'); 0209 0210 $scope.logo = '<?=$this->widgetConfig->logo?>'; 0211 0212 $scope.project = <?=$this->project->project_id ?>; 0213 $scope.uuid = ''; 0214 $scope.host = 'http://<?=$_SERVER ['HTTP_HOST']?>'; 0215 $scope.url = ''; 0216 $scope.embedCode = ''; 0217 $scope.pProvider = <?=$this->paymentProvider?> 0218 0219 0220 $scope.getEmbedCode = function () { 0221 $scope.url = $scope.host + '/widget/' + $scope.project + '/?' 0222 + 'sda=' + $scope.amounts.showDonationAmount + '&' 0223 + 'ssu=' + $scope.showSupporters + '&' 0224 + 'sco=' + $scope.showComments + '&' 0225 + 'log=' + $scope.logo + '&' 0226 + 'wbg=' + encodeURIComponent($scope.colors.widgetBg) + '&' 0227 + 'wco=' + encodeURIComponent($scope.colors.widgetContent) + '&' 0228 + 'whe=' + encodeURIComponent($scope.colors.headline) + '&' 0229 + 'wte=' + encodeURIComponent($scope.colors.text) + '&' 0230 + 'wbu=' + encodeURIComponent($scope.colors.button) + '&' 0231 + 'wbt=' + encodeURIComponent($scope.colors.buttonText) 0232 ; 0233 $scope.embedCode = '<iframe src="' + $scope.url + '" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" frameBorder=0 scrolling="no" allowTransparency="false" seamless ></iframe>'; 0234 } 0235 0236 }); 0237 0238 var PlingTip = (function () { 0239 return { 0240 setup: function () { 0241 $('.has-tooltip').hover(function (event) { 0242 event.preventDefault(); 0243 0244 var title = $(this).attr('title'); 0245 0246 $(this).tooltip({ 0247 title: title 0248 }); 0249 $(this).tooltip('show'); 0250 0251 }); 0252 } 0253 } 0254 })(); 0255 0256 $(document).ready(function () { 0257 PlingTip.setup(); 0258 }); 0259 0260 </script>