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 $plingData = $this->userPlings($this->product->project_id);
0024 $auth = Zend_Auth::getInstance();
0025 $btnName = $auth->hasIdentity() ? 'Confirm Donation' : 'Anonymous Pling';
0026 $this->headScript()
0027     ->appendFile('https://www.paypalobjects.com/js/external/dg.js');
0028 ?>
0029     <form id="support-form"
0030           class="standard-form partialpaypal"
0031           method="post"
0032           action="<?= $this->urlPay ?>"
0033           data-target="#overlays">
0034 
0035         <h3><?= $this->translate('Support ') ?><?= nl2br(strip_tags($this->product->title)) ?></h3>
0036 
0037         <div class="form-body">
0038             <input type="hidden" name="provider" id="provider" value="<?= $this->paymentProvider ?>">
0039             <input type="hidden" name="amount" id="amount" value="<?= $this->paymentAmount ?>">
0040 
0041             <div class="form-container">
0042                 <div class="controls controls-row">
0043                     <div class="col-md-4 col-lg-4 col-sm-4 col-xs-4">
0044                         <label for="payment_amount"><?= $this->translate('Support with') ?></label>
0045                         <span class="glyphicon glyphicon-usd"></span>
0046                         <span id="txt_payment_amount"><?= $this->paymentAmount ?></span>
0047                     </div>
0048                     <div class="col-md-8 col-lg-8 col-sm-8 col-xs-8">
0049                         <label class="payment-label"
0050                                for="payment_provider"><?= $this->translate('Payment Provider') ?></label>
0051 
0052                         <div class="payment-options">
0053                             <?php if ($this->paymentProvider == 'paypal') { ?>
0054                                 <div class="input-group">
0055                                 <span>
0056                                     <img src="/theme/flatui/img/logo_paypal.png"/>
0057                                 </span>
0058                                 </div>
0059                             <?php } ?>
0060                             <?php if ($this->paymentProvider == 'dwolla') { ?>
0061                                 <div class="input-group">
0062                                 <span>
0063                                     <img src="/theme/flatui/img/dwolla-btn-pay-lg.png"/>
0064                                 </span>
0065                                 </div>
0066                             <?php } ?>
0067                         </div>
0068                     </div>
0069                 </div>
0070                 <div class="controls controls-row">
0071                     <textarea id="comment" name="comment"
0072                               placeholder="&nbsp;<?= $this->translate('Write a comment (publicly visible)') ?>" rows="4"
0073                               class="col-md-12 col-lg-12 col-sm-12 col-xs-12"></textarea>
0074                 </div>
0075                 <div class="controls controls-row">
0076                 </div>
0077             </div>
0078         </div>
0079 
0080         <?php /* 
0081         <div class="form-footer">
0082             <?php if($auth->hasIdentity()) { ?>
0083             <div class="row small" style="margin:0;">
0084                 <span class="glyphicon glyphicon-question-sign pull-right has-popup"  style="margin-left:2px;"
0085                       data-trigger="hover"
0086                       data-container="body" data-toggle="popover" data-placement="bottom" data-html="true"
0087                       data-content="<span class='small'>The identity is only hidden from public by replacing your username with 'anonymous' as well as showing your comment as been written by 'anonymous'. Pling as well as the maker will still know from whom the donation came from.</span>"
0088                     ></span>
0089                 <label for="hideId" class="pull-right"><?=$this->translate('Hide my identity from public');?><input type="checkbox" name="hideId" id="hideId" value="1" style="width:auto;height:auto;padding:5px;margin-left:5px;position:relative;top:2px;"></label>
0090             </div>
0091             <?php } ?>
0092             <div class="row" style="margin:0;">
0093             <a href="<?=$this->buildProductUrl($this->product->project_id)?>" role="button" class="btn btn-native pull-left">
0094                 <?= $this->translate('Cancel') ?>
0095             </a>
0096             <button type="submit" id="submit_pling" class="btn btn-native pull-right" >
0097                 <?= $this->translate($btnName) ?>
0098             </button>
0099             </div>
0100         </div>
0101         */ ?>
0102         <div class="form-footer">
0103             <div class="row" style="margin:0;">
0104                 <a href="<?= $this->buildProductUrl($this->product->project_id) ?>"
0105                    role="button"
0106                    class="btn btn-native pull-left">
0107                     <?= $this->translate('Cancel') ?>
0108                 </a>
0109                 <?php if ($auth->hasIdentity()) { ?>
0110                     <button type="submit" id="submit_pling" class="btn btn-native pull-right">
0111                         <?= $this->translate($btnName) ?>
0112                     </button>
0113                 <?php } else { ?>
0114                     <a href="javascript:;" class="btn btn-native disabled pull-right ">
0115                         Please login to donate
0116                     </a>
0117                 <?php } ?>
0118             </div>
0119         </div>
0120 
0121     </form>
0122 
0123     <script type="text/javascript">
0124         $(document).ready(function () {
0125             $('#submit_pling').click(function () {
0126                 if ($('input[id=provider]').val() == 'dwolla') {
0127                     var newWindow = window.open(null, "dwollaFrame", "width=300,height=400,left=100,top=200");
0128                 }
0129             });
0130 
0131             $('.has-popup').hover(function () {
0132                 $(this).popover('show');
0133             });
0134         });
0135     </script>
0136 
0137 <?php
0138 $this->inlineScript()->appendScript(
0139     '$(document).ready(function(){
0140         PartialPayPal.initPayPalForm();
0141     });'
0142 );