File indexing completed on 2024-12-29 05:24:38

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 $helperHumanTiming = new Default_View_Helper_HumanTiming();
0024 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0025 $helperBuildBaseUrl = new Default_View_Helper_BuildBaseUrl();
0026 $helperUserIsOwner = new Default_View_Helper_UserIsOwner();
0027 $helperImage = new Default_View_Helper_Image();
0028 ?>
0029 <style>
0030     .background-white {
0031         background-color: white;
0032     }
0033 </style>
0034 <div id="comments">
0035     <h3>Comments</h3>
0036     <?php
0037     if (count($this->comments) == 0) {
0038         ?>
0039         <div>Be the first to comment</div>
0040         <?php
0041     } else { ?>
0042         <div><?php echo $this->paginationControl($this->comments, 'Sliding', '/partials/paginationControlBootstrap.phtml',
0043                 array('params' => array(), 'dom_target' => 'div#product-discussion')); ?></div>
0044 
0045         <?php foreach ($this->comments as $comment):
0046             //printComment($comment, $this, $this->product);
0047             echo $this->render('/product/partials/partialComment.phtml', array('comment' => $comment['comment'], 'marginLeft' => 30 * $comment['level'], 'product' => $this->product));
0048         endforeach; ?>
0049         
0050         <div><?php echo $this->paginationControl($this->comments, 'Sliding', '/partials/paginationControlBootstrap.phtml',
0051                 array('params' => array(), 'dom_target' => 'div#product-discussion')); ?></div>
0052     <?php } ?>
0053     <div><?php if (Zend_Auth::getInstance()->hasIdentity()) {
0054             $identity = Zend_Auth::getInstance()->getStorage()->read();
0055             ?>
0056             <a class="btn btn-native small show-maker-reply" style="padding: 4px;">add comment</a>
0057             <div class="popover-content maker-comment-container maker-form well" style="display:none;">
0058                 <div class="row">
0059                     <div class="col-md-11 col-lg-11 col-sm-11 col-xs-11">
0060                         <figure class="supporter-thumbnail relative">
0061                             <a href="<?= $helperBuildMemberUrl->buildMemberUrl($identity->username) ?>"
0062                                title="<?= $identity->username ?>">
0063                                 <img height="40" width="40" src="<?= $helperImage->Image($identity->profile_image_url,array('width' => 40, 'height' => 40, 'crop' => 2)); ?>"
0064                                      alt="<?= $identity->username ?>">
0065                             </a>
0066                         </figure>
0067                     </div>
0068                     <div class="col-md-1 col-lg-1 col-sm-1 col-xs-1">
0069                         <span class="glyphicon glyphicon-remove pull-right"></span>
0070                     </div>
0071                 </div>
0072 
0073                 <div class="maker-comment comment-content">
0074                     <div class="popover-content">
0075                         <form class="full-width" action="<?= $helperBuildBaseUrl->buildBaseUrl('productcomment/addreply') ?>">
0076                             <input type="hidden" name="i" value="0">
0077                             <input type="hidden" name="p" value="<?= $this->product->project_id ?>">
0078                             <input type="hidden" name="m" value="<?= $identity->member_id ?>">
0079                             <textarea name="msg" class="full-width"></textarea>
0080                             <input type="submit"
0081                                    class="btn btn-native small"
0082                                    style="padding:5px;margin-top:5px;"
0083                                    value="Send"/>
0084                         </form>
0085                     </div>
0086                 </div>
0087             </div>
0088         <?php } ?>
0089     </div>
0090 </div><!-- /.comment-content -->
0091 <script>
0092     $(document).ready(function () {
0093         $('body').on('click', 'div#comments a.show-maker-reply', function (event) {
0094             event.preventDefault();
0095             $(this).parent().find('a.show-maker-reply').hide();
0096             $(this).parent().find('.maker-form').show();
0097             return false;
0098         });
0099         $('body').on('click', 'div#comments span.glyphicon-remove', function (event) {
0100             event.preventDefault();
0101             $(this).parent().parent().parent().parent().parent().find('a.show-maker-reply').show();
0102             $(this).parent().parent().parent().parent().find('.maker-form').hide();
0103             return false;
0104         });
0105     });
0106 </script>