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

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 $helperEncryptUrl = new Default_View_Helper_EncryptUrl();
0024 $helperGetAuthUser = new Default_View_Helper_GetAuthUser();
0025 $helperBuildProductUrl = new Default_View_Helper_BuildProductUrl();
0026 $helperUserFollowsProject = new Default_View_Helper_UserFollowsProject();
0027 $helperImage = new Default_View_Helper_Image();
0028 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0029 $helperAddDefaultScheme = new Default_View_Helper_AddDefaultScheme();
0030 
0031 
0032 $user = $helperGetAuthUser->getAuthUser();
0033 $loginUrl = '/login?redirect=' . $helperEncryptUrl->encryptUrl(Zend_Controller_Front::getInstance()->getRequest()->getRequestUri(), true);
0034 $txtUserFollows = '';
0035 $urlUserFollows = $helperBuildProductUrl->buildProductUrl($this->product->project_id, 'unfollow');
0036 $imgFile = '/theme/flatui/img/icon-like-color.png';
0037 if (false == $helperUserFollowsProject->userFollowsProject($this->authMember->member_id, $this->product->project_id)) {
0038     $txtUserFollows = '';
0039     $urlUserFollows = $helperBuildProductUrl->buildProductUrl($this->product->project_id, 'follow');
0040     $imgFile = '/theme/flatui/img/icon-like.png';
0041 }
0042 $titleImage = $helperImage->Image($this->product->image_big, array('width' => 1170, 'height' => 300));
0043 $pathParts = explode('/', $titleImage);
0044 $titleImageName = $pathParts[sizeof($pathParts) - 1];
0045 $styleAttr = ' style="background-image: url(' . $titleImage . ');"';
0046 
0047 $imageTag = '<img src="' . $titleImage . '">';
0048 if (strpos($titleImage, 'default.png') !== false) {
0049     $imageTag = '';
0050 }
0051 $this->headScript()
0052     ->appendFile('https://www.paypalobjects.com/js/external/dg.js');
0053 
0054 //$viewTopHeader = 'product/partials/productTopHeader.phtml';
0055 $viewTopHeader = 'product/partials/productAboutSidebar.phtml';
0056 if ($this->product->claimable == 1) {
0057     $viewTopHeader = 'product/partials/productClaimTopHeader.phtml';
0058 }
0059 ?>
0060 
0061     <main id="product-page-content">
0062 
0063         <section class="head-wrap">
0064 
0065             <section class="wrapper">
0066 
0067                 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="product-main">
0068                     <!-- HEADER -->
0069                     <div id="product-header">
0070 
0071                         <!-- LOGO -->
0072                         <div id="product-logo" class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
0073                             <img style="border-radius: 2px;"  width="120" height="96"
0074                                  src="<?= $helperImage->Image($this->product->image_small, array('width' => 120, 'height' => 96)); ?>"/>
0075                         </div>
0076                         <!-- /LOGO -->
0077 
0078                         <!-- TITLE -->
0079                         <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
0080                             <h1 id="product-title">
0081                                 <?php if (false === empty($this->product->link_1)): ?><a
0082                                     href="<?php echo $helperAddDefaultScheme->addDefaultScheme($this->product->link_1); ?>"
0083                                     target="_NEW"
0084                                     title="<?php echo $helperAddDefaultScheme->addDefaultScheme($this->product->link_1); ?>"
0085                                     > <?= $this->product->title; ?> <span class="fa fa-external-link"></span></a>
0086                                 <?php else : ?>
0087                                     <?= $this->product->title; ?>
0088                                 <?php endif; ?>
0089                             </h1>
0090                             <span class="category"><?= $this->product->cat_title; ?></span>
0091                         </div>
0092                         <!-- /TITLE -->
0093 
0094                         <!-- the maker -->
0095                         <aside id="product-maker" class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
0096 
0097                             <?php if (empty($this->product->claimable)) { ?>
0098 
0099                                 <div class="">
0100                                     <div class="well about-me-sidebar-section">
0101                                         <div class="sidebar-content">
0102                                             <div class="row product-maker-sidebar">
0103                                                 <div class="col-md-7 col-lg-7 col-sm-7 col-xs-7 product-maker-summary">
0104                                                     <h5>
0105                                                         <a href="<?php echo $helperBuildMemberUrl->buildMemberUrl($this->member->username); ?>"><?= $this->member->username; ?></a>
0106                                                     </h5>
0107 
0108                                                 </div>
0109                                                 <div class="col-md-5 col-lg-5 col-sm-5 col-xs-5 product-maker-thumbnail relative">
0110                                                     <a href="<?php echo $helperBuildMemberUrl->buildMemberUrl($this->member->username); ?>"
0111                                                        title="<?= $this->member->username ?>">
0112                                                         <div class="profile-image-overlay-4 absolute"></div>
0113                                                         <img src="<?= $helperImage->Image($this->member->profile_image_url, array('width' => 40, 'height' => 40)); ?>"
0114                                                              alt="product-maker"
0115                                                              width="15"
0116                                                              height="15"
0117                                                              class="sidebar-profile-image">
0118                                                     </a>
0119                                                 </div>
0120 
0121                                             </div>
0122                                         </div>
0123                                     </div>
0124                                 </div>
0125 
0126                             <?php } ?>
0127                         </aside>
0128                         <!-- /the maker -->
0129                     </div>
0130                     <!-- /HEADER -->
0131 
0132 
0133                     <!-- TABS -->
0134                     <div id="product-tabs">
0135                         <ul class="nav nav-tabs">
0136                             <li><a href="#about-panel" data-toggle="tab">Product</a></li>
0137 
0138                             <?php if (null != ($this->product->embed_code) OR count($this->galleryPictures) > 0) { ?>
0139                                 <li>
0140                                     <a href="#media-panel" data-toggle="tab">
0141                                         <?php if (null != ($this->product->embed_code)) { ?>
0142                                             Media
0143                                         <?php } elseif (count($this->galleryPictures) > 0) { ?>
0144                                             Gallery
0145                                         <?php } ?>
0146                                     </a>
0147                                 </li>
0148                             <?php } ?>
0149 
0150                             <!-- ppload -->
0151                             <?php if ($this->product->ppload_collection_id): ?>
0152                                 <li><a href="#files-panel" data-toggle="tab"><?= $this->translate('Files') ?></a></li>
0153                             <?php endif; ?>
0154                             <!-- /ppload -->
0155                             <li><a href="#donations-panel" data-toggle="tab">Supporters</a></li>
0156                             <li class="active" id="donate-tab"><a href="#donate-panel" data-toggle="tab">Donate</a></li>
0157                         </ul>
0158                     </div>
0159                     <!-- /TABS -->
0160 
0161                     <!-- PANELS -->
0162 
0163                     <div class="tab-content row" id="product-panels">
0164 
0165                         <!-- ABOUT -->
0166                         <div class="tab-pane" id="about-panel">
0167 
0168 
0169                             <div id="product-about" class="col-lg-9 col-md-9 col-sm-9 col-xs-9">
0170 
0171                                 <div class="">
0172                                     <article>
0173                                         <?= nl2br(strip_tags($this->product->description)) ?>
0174                                     </article>
0175 
0176                                     <article>
0177                                         <?php if (count($this->updates) > 0) { ?>
0178                                             <?= $this->partialLoop('product/partials/productUpdates.phtml', $this->updates); ?>
0179                                         <?php } ?>
0180                                     </article>
0181 
0182                                 </div>
0183 
0184                             </div>
0185 
0186                             <?php
0187                             echo $this->partial(
0188                                 $viewTopHeader,
0189                                 array(
0190                                     "member" => $this->member,
0191                                     "product" => $this->product,
0192                                     "loginUrl" => $loginUrl,
0193                                     'product_views' => $this->product_views,
0194                                     'tab' => 'product',
0195                                     'supporter' => $this->supporter,
0196                                     'supporting' => $this->supporting,
0197                                     'plings' => $this->plings,
0198                                     'paymentStatus' => $this->paymentStatus,
0199                                     'paymentMessage' => $this->paymentMessage
0200                                 )
0201                             );
0202                             ?>
0203 
0204                         </div>
0205                         <!-- /ABOUT -->
0206 
0207                         <!-- DONATIONS -->
0208                         <div class="tab-pane" id="donations-panel">
0209 
0210                             <article class="col-lg-8 col-md-8 col-sm-8 col-xs-12" id="comments-container">
0211 
0212                                 <?php echo $this->render('product/partials/productSupporterComments.phtml') ?>
0213 
0214                             </article>
0215 
0216 
0217                             <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 list panel-grey-part" id="supporters">
0218                                 <h3>Supporters</h3>
0219                                 <?php
0220                                 if (count($this->supporting) > 0):
0221                                     $countSupporter = count($this->supporting->toArray());
0222                                     if ($countSupporter < 4) {
0223                                         $g = $countSupporter;
0224                                     } else {
0225                                         $g = 4;
0226                                     }
0227                                     $h = 0;
0228                                     $i = 3;
0229                                     foreach ($this->supporting as $supporter):
0230                                         $i++;
0231                                         $h++; ?>
0232 
0233                                         <div class="user">
0234                                             <div class="u-wrap">
0235                                                 <a href="<?php echo $helperBuildMemberUrl->buildMemberUrl($supporter->username); ?>">
0236                                                     <figure>
0237                                                         <img src="<?= $helperImage->Image($supporter->profile_image_url,array('width' => 200, 'height' => 200, 'crop' => 2)); ?>"/>
0238                                                     </figure>
0239                                                     <div class="u-content">
0240                                                         <h3><?= $supporter->username ?></h3>
0241                                                         <span>$<?= $supporter->sum_plings ?></span>
0242                                                     </div>
0243                                                 </a>
0244                                             </div>
0245                                         </div>
0246 
0247                                         <?php
0248                                     endforeach;
0249                                 endif;
0250                                 ?>
0251                             </div>
0252 
0253                         </div>
0254                         <!-- /DONATIONS -->
0255 
0256                         <!-- MEDIA -->
0257                         <div class="tab-pane" id="media-panel">
0258                             <?php if (null != ($this->product->embed_code)): ?>
0259                                 <?= Default_Model_HtmlPurify::purify($this->product->embed_code) ?>
0260                             <?php endif; ?>
0261                             <?php if (count($this->galleryPictures) > 0) {
0262                                 echo $this->render('product/partials/gallery.phtml', array('galleryPictures' => $this->galleryPictures)); ?>
0263                             <?php } ?>
0264                         </div>
0265                         <!-- /MEDIA -->
0266 
0267                         <!-- ppload -->
0268                         <?php if ($this->product->ppload_collection_id): ?>
0269                             <div id="files-panel" class="tab-pane">
0270                                 <article>
0271                                     <div data-ppload-api-uri="<?= PPLOAD_API_URI ?>"
0272                                          data-ppload-collection-id="<?= $this->product->ppload_collection_id ?>">
0273                                         <iframe src="" width="0" height="0" frameborder="0"
0274                                                 data-pling-music-uri="/pling-music-html5/embed.html"
0275                                                 seamless></iframe>
0276 
0277                                         <table class="table table-bordered" data-ppload-files="">
0278                                             <thead>
0279                                             <tr>
0280                                                 <th><?= $this->translate('Filename'); ?></th>
0281                                                 <th><?= $this->translate('Filetype'); ?></th>
0282                                                 <th style="text-align: right"><?= $this->translate('Filesize'); ?></th>
0283                                             </tr>
0284                                             </thead>
0285                                             <tbody></tbody>
0286                                             <tfoot>
0287                                             </tfoot>
0288                                         </table>
0289 
0290 
0291                                     </div>
0292                                 </article>
0293                             </div>
0294 
0295                             <script type="text/javascript">
0296                                 $(function () {
0297 
0298                                     var $pploadCollection = $('div[data-ppload-collection-id]');
0299                                     var $plingMusic = $pploadCollection.find('iframe[data-pling-music-uri]');
0300                                     var pploadApiUri = $pploadCollection.attr('data-ppload-api-uri');
0301                                     var hasFilesPanelOpened = false;
0302 
0303                                     function getPploadFiles(page) {
0304                                         var collectionId = $pploadCollection.attr('data-ppload-collection-id');
0305                                         if (!page) {
0306                                             page = 1;
0307                                         }
0308                                         $.ajax({
0309                                             url: pploadApiUri + 'files/index',
0310                                             type: 'GET',
0311                                             data: {
0312                                                 collection_id: collectionId,
0313                                                 perpage: 1000,
0314                                                 page: page,
0315                                                 format: 'json',
0316                                                 ignore_status_code: 1
0317                                             },
0318                                             dataType: 'json',
0319                                             success: function (data, textStatus, jqXHR) {
0320                                                 if (data.status != 'success') {
0321                                                     return;
0322                                                 }
0323 
0324                                                 var isPlayable = false;
0325                                                 var fileSizeSum = 0;
0326                                                 $.each(data.files, function () {
0327                                                     var fileDescription = '';
0328                                                     if (this.description) {
0329                                                         fileDescription = this.description;
0330                                                     }
0331                                                     $pploadCollection.find('table[data-ppload-files] tbody').append(
0332                                                         '<tr>'
0333                                                         + '<td><a href="' + pploadApiUri + 'files/download/'
0334                                                         + 'id/' + this.id + '/' + this.name + '">' + this.name + '</a><br>'
0335                                                         + fileDescription + '</td>'
0336                                                         + '<td>' + this.type + '</td>'
0337                                                         + '<td style="text-align: right">' + humanFileSize(this.size) + '</td>'
0338                                                         + '</tr>'
0339                                                     );
0340 
0341                                                     fileSizeSum += parseInt(this.size);
0342                                                     if (this.type == 'audio/mpeg' || this.type == 'application/ogg') {
0343                                                         isPlayable = true;
0344                                                     }
0345                                                 });
0346 
0347                                                 $pploadCollection.find('table[data-ppload-files] tfoot').append(
0348                                                     '<tr>'
0349                                                     + '<th colspan="2">' + data.pagination.totalItems + ' <?= $this->translate('files')?></th>'
0350                                                     + '<th style="text-align: right">' + humanFileSize(fileSizeSum) + '</th>'
0351                                                     + '</tr>'
0352                                                 );
0353 
0354                                                 $pploadCollection.find('a[data-ppload-download-link]').attr(
0355                                                     'href',
0356                                                     pploadApiUri + 'collections/download/id/' + collectionId
0357                                                 );
0358                                                 if (isPlayable && !$plingMusic.attr('src')) {
0359                                                     $plingMusic.attr({
0360                                                         src: $plingMusic.attr('data-pling-music-uri')
0361                                                         + '?play_collection=' + collectionId,
0362                                                         width: '100%',
0363                                                         height: '500'
0364                                                     });
0365                                                 }
0366                                                 /*if (data.pagination !== 'undefined' && data.pagination.next) {
0367                                                     getPploadFiles(data.pagination.next);
0368                                                 }*/
0369                                             },
0370                                             error: function (jqXHR, textStatus, errorThrown) {
0371 
0372                                             }
0373                                         });
0374                                     }
0375 
0376                                     function humanFileSize(bytes) {
0377                                         var size = '';
0378                                         size = (bytes / 1048576).toFixed(2) + ' MB';
0379                                         /*
0380                                          if (bytes >= 1073741824) {
0381                                          size = (bytes / 1073741824).toFixed(2) + 'GB';
0382                                          }
0383                                          else if (bytes >= 1048576) {
0384                                          size = (bytes / 1048576).toFixed(2) + 'MB';
0385                                          }
0386                                          else if (bytes >= 1024) {
0387                                          size = (bytes / 1024).toFixed(2) + 'KB';
0388                                          }
0389                                          else {
0390                                          size = bytes + 'bytes';
0391                                          }*/
0392                                         return size;
0393                                     }
0394 
0395                                     $('a[href="#files-panel"][data-toggle="tab"]').on('click', function () {
0396                                         if (!hasFilesPanelOpened) {
0397                                             getPploadFiles();
0398                                             hasFilesPanelOpened = true;
0399                                         }
0400                                     });
0401 
0402                                 });
0403                             </script>
0404                         <?php endif; ?>
0405                         <!-- /ppload -->
0406 
0407                         <!-- DONATE -->
0408                         <div class="tab-pane active" id="donate-panel">
0409 
0410                             <article class="col-lg-12 col-md-12 col-sm-12 co-xs-12" id="payment-container">
0411                                 <?php
0412                                 echo $this->partial(
0413                                     'product/partials/productPling.phtml',
0414                                     array(
0415                                         "member" => $this->member,
0416                                         "product" => $this->product,
0417                                         "loginUrl" => $loginUrl,
0418                                         'product_views' => $this->product_views,
0419                                         'tab' => 'product',
0420                                         'auth' => $this->auth,
0421                                         'txtUserFollows' => $txtUserFollows,
0422                                         'urlUserFollows' => $urlUserFollows,
0423                                         'imgFile' => $imgFile,
0424                                         'titleImage' => $titleImage,
0425                                         'imageTag' => $imageTag,
0426                                         'userFollowsProject' => $this->userFollowsProject,
0427                                         'paymentAmount' => $this->amount,
0428                                         'paymentComment' => $this->comment,
0429                                         'paymentProvider' => $this->provider,
0430                                         'urlPay' => $this->urlPay
0431                                     )
0432                                 );
0433                                 ?>
0434                             </article>
0435 
0436                         </div>
0437                         <!-- /DONATE -->
0438 
0439                     </div>
0440 
0441                     <!-- /PANELS -->
0442 
0443                     <span class="page-views"><?= $this->product_views ?> page views</span>
0444 
0445                 </div>
0446 
0447             </section>
0448 
0449         </section>
0450 
0451         <section class="body-wrap full-width">
0452 
0453             <section class="wrapper">
0454 
0455                 <!-- PAGE BODY -->
0456 
0457                 <section class="full-width product-page">
0458 
0459                     <!-- page content -->
0460 
0461                     <div class="col-md-12 col-lg-12 col-sm-12 col-xs-12 product-details">
0462 
0463                         <!-- panels -->
0464                         <div class="tab-content product-description">
0465 
0466 
0467                         </div>
0468                         <!-- /panels -->
0469 
0470                     </div>
0471 
0472                     <!-- /page content -->
0473 
0474                     <!-- sidebar -->
0475 
0476                     <!-- /sidebar -->
0477 
0478                 </section>
0479 
0480                 <!-- /PAGE BODY -->
0481 
0482             </section>
0483 
0484         </section>
0485 
0486     </main>
0487 
0488 
0489 <?php $this->inlineScript()->appendScript(
0490     '    $(document).ready(function(){
0491 
0492             newProductPage.setup();
0493         });
0494     ');