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

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 $helperUserRole = new Backend_View_Helper_UserRole();
0024 $userRoleName = $helperUserRole->userRole();
0025 $isAdmin = false;
0026 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) {
0027     $isAdmin = true;
0028 
0029 
0030 $modelInfo = new Default_Model_Info();
0031 $modelSection = new Default_Model_Section();
0032 $modelSectionSupport = new Default_Model_DbTable_SectionSupport();
0033 
0034 
0035 $catId = $this->cat_id;
0036 $section = null;
0037 
0038 if($catId && $catId > 0) {
0039     $section = $modelSection->fetchSectionForCategory($catId);
0040 } else {
0041     $storeCatIds = Zend_Registry::isRegistered('store_category_list') ? Zend_Registry::get('store_category_list') : null;
0042     $storeCatIds = implode( ", ", $storeCatIds );
0043     try {
0044         $section = $modelSection->fetchFirstSectionForStoreCategories($storeCatIds);
0045     } catch (Exception $exc) {
0046         $section = null;
0047     }
0048 }
0049 
0050 
0051 
0052 if(!$section) {
0053     $section = array('name' => 'Test', 'section_id' => '1');
0054 }
0055 $identity = Zend_Auth::getInstance()->getStorage()->read();
0056 if($identity) {
0057     $isSupporter = $modelSection->isMemberSectionSupporter($section['section_id'], $identity->member_id);
0058 }
0059 
0060 $supportData = array();
0061 if($isSupporter) {
0062     $support = $modelSectionSupport->fetchLatestSectionSupportForMember($section['section_id'], $identity->member_id);
0063 }
0064 
0065 $this->supporters = $modelInfo->getNewActiveSupportersForSection($section['section_id'],9);
0066 
0067 
0068 $helpPrintDate = new Default_View_Helper_PrintDate();
0069 
0070 $config = Zend_Registry::get('config')->settings->client->default;
0071 $baseurlStore = $config->baseurl_store;
0072 
0073 
0074 ?>
0075 
0076 
0077 
0078         <div  class="supportDiv  withborder" >
0079             <h4>Support-Box</h4>
0080             
0081             <?php
0082                 if($isSupporter) {
0083             ?>
0084                 <span style="padding-bottom: 10px;font-size: small;">Thank you very much for supporting <?= $section['name'] ?>
0085                 <?php
0086                 if($isAdmin) {
0087                  ?>
0088                 <a href="<?=$baseurlStore.'/section?id='.$section['section_id']?>"> * </a> 
0089                 <?php
0090                     }
0091                 ?>
0092                 with $<?= $support['tier'] ?> per month.</span>
0093                 <!--
0094                 <div class="supportDiv" style="padding-top: 15px;">
0095                     <a href="/support" class="btn btn-primary btn-lg active btn-block" role="button" aria-pressed="true">Thank you for your support!</a>
0096                 </div>
0097                 -->
0098             <?php
0099                 } else {
0100             ?>
0101             
0102             <span style="padding-bottom: 10px;font-size: small;">The category is part of <?= $section['name'] ?> and supported by the following people:</span>        
0103             <div class="row" style="margin-top: 10px;margin-bottom: 20px;">
0104             <?php 
0105                     $i=0;
0106                    foreach ($this->supporters as $user) {                                                      
0107                     if($i++>6) break;
0108                ?>         
0109                <a href="<?php echo $this->buildMemberUrl($user['username']); ?>" class="tooltipuserleft" data-tooltip-content="#tooltip_content" data-user="<?=$user['member_id']?>">                   
0110                     <img height="25" width="25" src="<?php echo $this->Image($user['profile_image_url'], array('width' => '25', 'height' => '25', 'crop' => 2)); ?>" class="supporterx" />                   
0111                </a>
0112                <?php } ?>
0113             </div>
0114             
0115             
0116             <form action="<?= $baseurlStore ?>/support-predefined" method="POST">
0117                 <input type="hidden" name="section_id" value="<?= $section['section_id'] ?>">
0118                 <div style="">
0119                     <span style="text-align: left;font-size: small">Support all products via a monthly donation of</span>
0120                     <span style="text-align: left;">  
0121                         <ul style="list-style: none;">
0122                             <li><input type="radio" name="amount_predefined" value="0.99" checked="checked"> $0.99</li>
0123                             <li><input type="radio" name="amount_predefined" value="2"> $2</li>
0124                             <li><input type="radio" name="amount_predefined" value="5"> $5</li>
0125                             <li><input type="radio" name="amount_predefined" value="10"> $10</li>
0126                             <li><input type="radio" name="amount_predefined" value="free">$<input type="text" name="support_amount"><div>Enter a free Amount</div></li>
0127                         </ul>
0128                     </span>
0129                 </div>   
0130 
0131                 <div class="supportDiv" >
0132                     <button type="submit" class="btn btn-primary btn-lg active btn-block" role="button" aria-pressed="true">Support</button>
0133                 </div>
0134             </form>
0135         
0136         <?php
0137             }
0138         ?>
0139 
0140 
0141             
0142         </div>
0143 
0144 <?php
0145 
0146 }