File indexing completed on 2024-12-29 05:24:49
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 * Created: 31.05.2017 0023 */ 0024 $modelInfo= new Default_Model_Info(); 0025 $filter = new Local_Filter_Url_Encrypt(); 0026 $thisurl = "/"; 0027 if(isset($_GET['url'])) { 0028 $thisurl = $_GET['url']; 0029 }else 0030 { 0031 $thisurl= Zend_Controller_Front::getInstance()->getRequest()->getScheme() . '://' . Zend_Controller_Front::getInstance()->getRequest()->getHttpHost().$_SERVER["REQUEST_URI"]; 0032 } 0033 0034 0035 $url_login = "/login/redirect/".$filter->filter($thisurl); 0036 0037 $sections = $this->sections; 0038 0039 $creator_id = $this->creator_id; 0040 $baseurlStore = Zend_Registry::get('config')->settings->client->default->baseurl_store; 0041 ?> 0042 <link href="/theme/flatui/css/support.css" rel="stylesheet"> 0043 0044 0045 <style> 0046 .amount input { 0047 opacity: .95; 0048 margin-top: -8px; 0049 color: #000; 0050 font-size: 24px; 0051 width: 50%; 0052 margin: 0; 0053 margin-top: 0px; 0054 margin-top: 0; 0055 border: 0; 0056 border-bottom-color: currentcolor; 0057 border-bottom-style: none; 0058 border-bottom-width: 0px; 0059 border-bottom: 1px solid #d0d0d0; 0060 padding: 0; 0061 box-shadow: none; 0062 background-color: #fff; 0063 } 0064 0065 .unit-wrapper { 0066 position: absolute; 0067 display: inline-block; 0068 } 0069 0070 .unit-wrapper .unit { 0071 color: #231f20; 0072 opacity: .6; 0073 font-size: 13px; 0074 position: absolute; 0075 top: 5px; 0076 right: 3px; 0077 line-height: 10px; 0078 } 0079 0080 .item-text { 0081 padding-left: 15px; 0082 } 0083 0084 .disabled { 0085 cursor: not-allowed !important; 0086 background-color: #959595 !important; 0087 box-shadow: 0 2px 0 0 #404040 !important; 0088 } 0089 0090 .hiddden { 0091 display: none !important; 0092 } 0093 0094 </style> 0095 0096 <main> 0097 <section class="wrapper" id="products-wrapper"> 0098 <form class="donation-form" id="new_donation" action="<?= $this->urlPay ?>" accept-charset="UTF-8" data-remote="true" method="post"> 0099 <input type="hidden" id="currency-symbol" value="$"> 0100 <input type="hidden" name="provider" value="paypal" id="provider"> 0101 <input type="hidden" name="creator_id" value="<?= $creator_id ?>" id="creator_id"> 0102 <div class="container-fluid"> 0103 <div class="row"> 0104 <div class="sidebar-left col-md-2"></div> 0105 0106 0107 <div class="content col-md-8"> 0108 <h2>Become a Supporter</h2> 0109 <p>Support any of these sections and their creators via a donation:</p> 0110 </p> 0111 0112 0113 <div class="x-donation-widget"> 0114 <div class="row disply-flex"> 0115 0116 <div class="col-lg-4" style="padding-left: 15px; min-width: 250px;"> 0117 <div class="x-tabs-header " style="text-align: center;"> 0118 <div class="header-content"> 0119 Section 0120 0121 </div> 0122 </div> 0123 </div> 0124 <div class="col-lg-3"> 0125 <div class="x-tabs-header " style="padding: 0 35px;"> 0126 <div class="header-content"> 0127 Pick Amount 0128 0129 </div> 0130 </div> 0131 </div> 0132 <div class="col-lg-3 col-md-2" style="min-width: 150px;"> 0133 <div class="x-tabs-header " style="padding: 0 20px;"> 0134 <div class="header-content"> 0135 Enter Amount 0136 </div> 0137 </div> 0138 </div> 0139 0140 <!-- 0141 <div class="col-lg-2 col-md-2" style=""> 0142 <div class="x-tabs-header "> 0143 <div class="header-content"> 0144 Payment 0145 <br><span style="font-size: small;" class="extrasmall">(can be cancelled at any time before next year)</span> 0146 </div> 0147 </div> 0148 </div> 0149 --> 0150 <div class="col-lg-2 col-md-2 text-right" style="padding-right: 15px;"> 0151 <div class="x-tabs-header "> 0152 <div class="header-content"> 0153 <?php /*Supporters */?> 0154 </div> 0155 </div> 0156 </div> 0157 0158 <!-- 0159 <div class="col-lg-2 col-md-2 " style="padding-right: 15px;"> 0160 <div class="x-tabs-header "> 0161 <div class="header-content" style="text-align:right;padding-right:15px;"> 0162 Next Goal 0163 </div> 0164 </div> 0165 </div> 0166 --> 0167 </div> <!--end of row--> 0168 <?php 0169 foreach ($sections as $section) { 0170 ?> 0171 <div class="row disply-flex"> 0172 <div class="col-lg-4" style="padding-left: 15px;min-width: 250px;"> 0173 0174 <div class="text" style="padding: 16px;"> 0175 <?= $section['name'] ?> 0176 </div> 0177 </div> 0178 <div class="col-lg-3" style="padding-left: 0;"> 0179 0180 <div class="radiocontainer" style="text-align: left;"> 0181 <input data-section-id="<?= $section['section_id'] ?>" class="suggested-amount mdl-radio__button" data-checked="false" <?=$this->payment_options['Option5']['checked']?> id="sam-15-<?= $section['section_id'] ?>" type="radio" value="<?=$this->payment_options['Option5']['name']?>" name="amount_predefined-<?= $section['section_id'] ?>"/> 0182 <span class="item-text"> 0183 <span class="unit-wrapper"> 0184 <span class="unit">$</span> 0185 </span> 0186 <span class="amount" style="font-size: 18px;">0.99</span> monthly 0187 </span> 0188 </div> 0189 0190 0191 </div> 0192 0193 <div class="col-lg-3 col-md-3" style="min-width: 150px;"> 0194 <div class="radiocontainer" style="text-align: left;"> 0195 <input data-section-id="<?= $section['section_id'] ?>" class="suggested-amount custom_amount_item mdl-radio__button" data-checked="false" <?=$this->checked?> id="custom_amount_item_<?= $section['section_id'] ?>" type="radio" value="Option7" name="amount_predefined-<?= $section['section_id'] ?>"> 0196 <span class="item-text"> 0197 <span class="unit-wrapper"> 0198 <span class="unit">$</span> 0199 </span> 0200 <span class="amount"><input data-section-id="<?= $section['section_id'] ?>" class="custom_amount" id="custom_amount-<?= $section['section_id'] ?>" min="1" step="any" inputmode="numeric" type="number" name="amount_handish-<?= $section['section_id'] ?>"> </span> 0201 <!-- 0202 <div> 0203 <span class="amount" ><span style="font-size: x-small;padding-left: 32px;">Enter a amount > $1 </span></span> 0204 </div> 0205 --> 0206 </span> 0207 </div> 0208 </div> 0209 <!-- 0210 <div class="col-lg-2 col-md-2"> 0211 <span class="amount">Total: xxx</span> 0212 <span class="amount" ><span style="font-size: x-small;">(incl. x Taxes and y Paypal Fees)</span></span> 0213 0214 </div> 0215 --> 0216 <div class="col-lg-2 text-right" > 0217 <ul class="x-suggested-amounts"> 0218 <li class="amount-item"> 0219 <div class="item-text"> 0220 <span class="amount" > 0221 <?php /*<?php echo $modelInfo->getCountSectionSupporters($section['section_id']);?></span> */?> 0222 </div> 0223 </li> 0224 </ul> 0225 0226 </div> 0227 <!-- 0228 <div class="col-lg-2" > 0229 <ul class="x-suggested-amounts"> 0230 <li class="amount-item"> 0231 <div class="item-text"> 0232 <span class="amount" > 0233 (Balken) 0234 </div> 0235 </li> 0236 </ul> 0237 0238 </div> 0239 --> 0240 </div> <!--end of row--> 0241 0242 0243 0244 <?php 0245 } 0246 ?> 0247 0248 <div class="row disply-flex"> 0249 <div class="col-lg-12 col-md-12" style="border-top: dotted thin #E7E7E7 !important;padding-top: 35px;"> 0250 <div class="tabs-footer"> 0251 Donation-Sum: $<span id="sum">0.00</span>/Month 0252 - Pay 0253 <select name="paymentFrequenz"> 0254 <option value="Y">Yearly</option> 0255 <option value="M">Monthly</option> 0256 </select> 0257 <div> 0258 <span style="font-size: x-small;" id="desc_1"></span> 0259 </div> 0260 <div> 0261 <span style="font-size: x-small;" id="desc_2"></span> 0262 </div> 0263 0264 0265 </div> 0266 </div> 0267 </div> <!--end of row--> 0268 0269 <div class="row disply-flex"> 0270 <div class="col-lg-12 col-md-12"> 0271 <div class="tabs-footer"> 0272 <?php if (Zend_Auth::getInstance()->hasIdentity()) {?> 0273 <button disabled="true" type="submit" id="submit" class="disabled dw-btn mdl-button mdl-js-button mdl-js-ripple-effect step-3 basic-color-background" data-upgraded=",MaterialButton,MaterialRipple"> 0274 <span class="donate" id="linkButton"> 0275 <span class="amount"> 0276 <span isolate="">Donate via PayPal</span> 0277 </span> 0278 </span> 0279 </button> 0280 <?php }else{ 0281 echo "<a href='".$url_login."'>Please login to donate</a>"; 0282 }?> 0283 </div> 0284 </div> 0285 </div> <!--end of row--> 0286 </div> <!--end of tabs--> 0287 0288 0289 </div> <!--end of content--> 0290 <div class="sidebar-right col-md-2"></div> 0291 0292 </div> 0293 0294 </div> 0295 </form> 0296 </section> 0297 </main> 0298 0299 <script> 0300 $(document).ready(function(){ 0301 $checkedBoxes = []; 0302 0303 calSum(); 0304 0305 $('.cat_drop_down').click(function(){ 0306 $section_id = $(this).attr('data-section-id'); 0307 $dropdown = $('cat_drop_down-'+$section_id); 0308 0309 if($dropdown.hasClass('hidden')) { 0310 $dropdown.removeClass('hidden'); 0311 } else { 0312 $dropdown.addClass('hidden'); 0313 } 0314 0315 }); 0316 0317 $('#submit').click(function(){ 0318 $("input[type=radio]:checked").each(function() { 0319 $section_id = $(this).attr('data-section-id'); 0320 0321 if($(this).hasClass('custom_amount_item')) { 0322 $input = $('#custom_amount-'+$section_id); 0323 0324 if($input.val() == '') { 0325 $(this).prop('checked', false); 0326 } 0327 } 0328 }); 0329 0330 }); 0331 0332 $(".custom_amount").click(function(){ 0333 $section_id = $(this).attr('data-section-id'); 0334 //alert('Section: ' + $section_id); 0335 $('#sam-15-'+$section_id).removeAttr('checked'); 0336 $('#custom_amount_item_'+$section_id).prop("checked", true); 0337 0338 for( var i = 0; i < $checkedBoxes.length; i++){ 0339 if ( $checkedBoxes[i] === '#sam-15-'+$section_id) { 0340 $checkedBoxes.splice(i, 1); 0341 } 0342 } 0343 0344 calSum(); 0345 }); 0346 0347 0348 $('.custom_amount').change(function(){ 0349 calSum(); 0350 }); 0351 0352 0353 0354 $(".mdl-radio__button").click(function(){ 0355 $wasChecked = $(this).attr("data-checked"); 0356 $section_id = $(this).attr('data-section-id'); 0357 0358 if($checkedBoxes.includes($(this).attr('id'))) { 0359 //Is checked, so remove marker and elem in array 0360 for( var i = 0; i < $checkedBoxes.length; i++){ 0361 if ( $checkedBoxes[i] === $(this).attr('id')) { 0362 $checkedBoxes.splice(i, 1); 0363 } 0364 } 0365 $(this).removeAttr('checked'); 0366 $(this).prop('checked', false); 0367 0368 } else { 0369 $checkedBoxes.push($(this).attr('id')); 0370 //$(this).prop("checked", true); 0371 } 0372 calSum(); 0373 }); 0374 0375 function calSum() { 0376 $obj = null; 0377 $sum = $("#sum"); 0378 $sumNum = 0; 0379 0380 $("input[type=radio]:checked").each(function() { 0381 $section_id = $(this).attr('data-section-id'); 0382 0383 if($(this).hasClass('custom_amount_item')) { 0384 $input = $('#custom_amount-'+$section_id); 0385 0386 if($input.val() != '') { 0387 $num = parseFloat($input.val()); 0388 $sumNum += $num; 0389 } 0390 } else { 0391 $sumNum += 0.99; 0392 } 0393 }); 0394 0395 if($sumNum>0) { 0396 0397 $monthNum = calForMonth($sumNum); 0398 $yearNum = calForYear($sumNum); 0399 0400 $('#desc_1').text("(Pay $" + $monthNum + " per Month, "+calFees($sumNum)+" or Pay $" + $yearNum + " per Year, "+calFees($sumNum*12)+")"); 0401 0402 0403 $sumNum = Math.round($sumNum * 100 )/100; 0404 $sumNum = $sumNum.toFixed(2); 0405 0406 $sum.text($sumNum); 0407 $('#submit').prop('disabled', false); 0408 $('#submit').removeClass('disabled'); 0409 0410 } else { 0411 $sum.text('0.00'); 0412 $('#desc_1').text(""); 0413 $('#submit').prop('disabled', true); 0414 0415 $('#submit').addClass('disabled'); 0416 } 0417 0418 } 0419 0420 0421 function calForMonth(num) { 0422 0423 paypal_fix = 0.3; 0424 paypal_var = 0.029; 0425 tax = 0.19; 0426 0427 v = (num + paypal_fix)/( 1- ( ( paypal_var) + (tax/(1+tax)) )); 0428 v = Math.round(v * 100 )/100; 0429 v = v.toFixed(2); 0430 return v; 0431 } 0432 0433 function calForYear(num) { 0434 num = num * 12; 0435 paypal_fix = 0.3; 0436 paypal_var = 0.029; 0437 tax = 0.19; 0438 0439 v = (num + paypal_fix)/( 1- ( ( paypal_var) + (tax/(1+tax)) )); 0440 v = Math.round(v * 100 )/100; 0441 v = v.toFixed(2); 0442 return v; 0443 } 0444 0445 0446 function calFees(num) { 0447 paypal_fix = 0.3; 0448 paypal_var = 0.029; 0449 tax = 0.19; 0450 0451 v = (num + paypal_fix)/( 1- ( ( paypal_var/(1+paypal_var)) + (tax/(1+tax)) )); 0452 paypal = paypal_fix+v*paypal_var; 0453 total = num + paypal; 0454 t=total*tax; 0455 g = total+t; 0456 0457 r = 'incl. $' + (Math.round(t * 100 )/100).toFixed(2) + ' Tax and $'+(Math.round(paypal * 100 )/100).toFixed(2)+' PayPal Fees'; 0458 return r; 0459 } 0460 0461 0462 0463 }); 0464 </script>