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

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 $requestUri = Zend_Controller_Front::getInstance()->getRequest()->getRequestUri();
0025 $helpProductUrl = new Default_View_Helper_BuildProductUrl();
0026 $productUrl = $helpProductUrl->buildProductUrl($this->product->project_id);
0027 $loginUrl = '/login?redirect=' . $helperEncryptUrl->encryptUrl($productUrl.'#comments_block', true);
0028 $helperHumanTiming = new Default_View_Helper_HumanTiming();
0029 $helperBuildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0030 $helperBuildBaseUrl = new Default_View_Helper_BuildBaseUrl();
0031 $helperImage = new Default_View_Helper_Image();
0032 $identity = Zend_Auth::getInstance()->getStorage()->read();
0033 $pageCount = $this->comments->getTotalItemCount()/$this->comments->getItemCountPerPage();
0034 
0035 $helperUserRole = new Backend_View_Helper_UserRole();
0036 $userRoleName = $helperUserRole->userRole();
0037 $isAdmin = false;
0038 if (Default_Model_DbTable_MemberRole::ROLE_NAME_ADMIN == $userRoleName) {
0039     $isAdmin = true;
0040 }
0041 
0042 //$captcha = new Zend_Captcha_Image(array(
0043 //    'name' => 'foo',
0044 //    'wordLen' => 6,
0045 //    'timeout' => 300,
0046 //));
0047 //$captcha->setFont(APPLICATION_PATH . '/../httpdocs/theme/flatui/fonts/OpenSans-Regular.ttf');
0048 //$captcha->generate();
0049 
0050 
0051 ?>
0052 <div>
0053     <div class="row">
0054         <div class="col-lg-12 col-md-12">
0055             <div class="page-header relative">
0056                 <h3 style="line-height: 15px;">
0057                     <small class="pull-right">
0058                         <div class="row" style="margin:0;padding: 0;text-align: right;"><?=$this->comments->getTotalItemCount()?> comments</div>
0059                         <?php if ($pageCount > 1) echo $this->paginationControl($this->comments, 'Sliding', '/partials/paginationControlComment.phtml',
0060                             array('params' => array('project_id'=>$this->product->project_id), 'dom_target' => 'div#product-comment-moderation')); ?></small>
0061                     Comments
0062                 </h3>
0063                 <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?>
0064                     <p style="position: absolute; top:25px;">
0065                         <small class="small"> Add a comment</small>
0066                     </p>
0067                     <div class="collapse in" id="add-comment" style="padding-top: 8px;padding-bottom:8px">
0068                         <form class="full-width product-add-comment-moderation" action="/productcomment/addreply" >
0069                             <input type="hidden" name="p" value="<?= $this->product->project_id ?>">
0070                             <input type="hidden" name="m" value="<?= $identity->member_id ?>">
0071                             <input type="hidden" name="t" value="30">
0072                             <textarea name="msg" class="full-width" required="required"></textarea>
0073                             <button type="submit" style="border:none;background: transparent;color: #2673b0; float: right" class="small"><span class="glyphicon glyphicon-send"></span> Send</button>
0074                         </form>
0075                     </div>
0076                 <?php } else { ?>
0077                     <p style="position: absolute; top:25px;">
0078                         <small class="small"><span class="glyphicon glyphicon-share-alt"></span> Please <a href="<?=$loginUrl?>" rel="nofollow">login</a> or <a href="/register" rel="nofollow">register</a> to add a comment</a></small>
0079                     </p>
0080                 <?php } ?>
0081             </div>
0082             <div class="comments-list"><a name="comments_block"></a>
0083                 <?php if (0 == $this->comments->getCurrentItemCount()) { ?>
0084                 <div>Be the first to comment</div>
0085                 <?php } ?>
0086 <?php foreach ($this->comments as $elementComment): ?>
0087     <?php
0088     $comment = $elementComment['comment'];
0089     if (false == $comment['comment_active']) {
0090         continue;
0091     }
0092     $age = $helperHumanTiming->humanTiming($comment['comment_created_at']);
0093 //    $captcha = new Zend_Form_Element_Captcha('realHuman',array(
0094 //            'captcha' => array(
0095 //                'captcha' => 'image',
0096 //                'font' => APPLICATION_PATH . '/../httpdocs/theme/flatui/fonts/OpenSans-Regular.ttf',
0097 //                'wordLen' => 6,
0098 //                'timeout' => 300,
0099 //                'width' => 250
0100 //            ))
0101 //    );
0102 //    $captcha->setAttrib('placeholder', 'Please verify you\'re a human');
0103 //    $captcha->setAttrib('class', 'full-width');
0104     ?>
0105                 <div class="media" style="margin-left:<?=($elementComment['level']-1) * 30?>px">
0106                     
0107                     <?php if ($comment['comment_type'] == Default_Model_DbTable_Comments::COMMENT_TYPE_PLING) : ?>
0108                         <p class="pull-right history" style="display:inline-block"><span class="glyphicon glyphicon-usd"></span></p>
0109                     <?php endif ?>
0110                     <a class="media-left" href="<?= $helperBuildMemberUrl->buildMemberUrl($comment['username']) ?>">
0111                         <div class="profileimage" style="position:relative;display:inline-block;">
0112                        <?php                       
0113                         if($this->product->member_id == $comment['member_id']){
0114                        ?>
0115                        <span class="creator-badge-<?=($elementComment['level']>1?2:1)?>" >C</span> 
0116                        <?php }?>
0117 
0118                        <?php                       
0119                         if($comment['issupporter']){
0120                             $isSupporterActive = $this->isSupporterActive($comment['member_id']);
0121                        ?>
0122                        <span class="supporter-badge-<?=($elementComment['level']>1?2:1)?>  <?=($isSupporterActive?'':'inactive')?>" >S<?=$comment['issupporter']?></span>                       
0123                        <?php }?>
0124                        
0125                        <?php 
0126                         $modelSectionSupport = new Default_Model_SectionSupport();
0127                         $isAffiliate = $modelSectionSupport->isMemberAffiliateForMember($this->product->member_id, $comment['member_id']);
0128                         if($isAffiliate && $this->product->member_id != $comment['member_id']){
0129                        ?>
0130                        <span class="creator-badge-<?=($elementComment['level']>1?2:1)?>" >A</span> 
0131                        <?php }?>
0132                        
0133                        <?php
0134                        if(!is_null($comment['rating_member']) && $comment['rating_member']!='-1')
0135                        {?>
0136                        <span class="creator-badge-<?=($elementComment['level']>1?2:1)?>" style="background-color:<?=$this->fetchScoreColor($comment['rating_member'])?>; padding:3px;border-radius: 3px">
0137                             <?=$comment['rating_member']?>
0138                         </span> 
0139                        <?php }?>
0140                        
0141                        <?php 
0142                         $wasAffiliate = $modelSectionSupport->wasMemberAffiliateForMember($this->product->member_id, $comment['member_id']);
0143                         if($wasAffiliate && $this->product->member_id != $comment['member_id']){
0144                        ?>
0145                        <span class="creator-badge-<?=($elementComment['level']>1?2:1)?>" style="background: gray !important;">A</span> 
0146                        <?php }?>
0147                        
0148 
0149                         <img src="<?= $helperImage->Image($comment['profile_image_url'], array('width' => 60, 'height' => 60)) ?>" class="img<?= $elementComment['level']?>">
0150                                                
0151                         </div>
0152                          <?php if( $comment['roleid'] ==Default_Model_DbTable_Member::ROLE_ID_MODERATOR) { ?>
0153                                 <div class="mod-badge-1">MOD</div>                                                  
0154                         <?php }?>
0155                     </a>
0156                     <div class="media-body">
0157                         <h4 class="media-heading user_name">
0158                               
0159                                   <a  class="tooltipuser"  data-tooltip-content="#tooltip_content" role="button" data-user="<?=$comment['member_id'] ?>" href="<?= $helperBuildMemberUrl->buildMemberUrl($comment['username']) ?>"> <?= $comment['username'] ?> </a>                              
0160 
0161                                 <p class="pull-right history" >
0162                                     <?php if ($age['age'] > 0) { ?>
0163                                     <small><?= $age['age'] ?> <span class="light"><?= $age['unit'] ?> ago</span></small>
0164                                     <?php } ?>
0165                                 </p>
0166                         </h4>
0167                         
0168                         <div class="text">
0169                         
0170                         <?php
0171                             if(!is_null($comment['rating']) && $comment['rating']!='-1')
0172                             { ?>                                                           
0173                                <span class="rating-label" style="background-color:<?=$this->fetchScoreColor($comment['rating'])?>; "> <?=$comment['rating'] ?></span>  
0174                             <?php                             
0175                                 /*
0176                                     <span class="score label" style="margin-right:5px;background-color:<?=$this->fetchScoreColor($comment['rating'])?>; ">
0177                                     <?=$comment['rating'] ?>
0178                                 </span> 
0179                                 if($comment['rating']==1){
0180                                     echo '<span class="btn btn-success active" style="cursor:default;line-height: 10px;padding: 3px 6px;"><span class="fa fa-plus" ></span></span>';
0181                                 }else
0182                                 {
0183                                     echo '<span class="btn btn-danger active" style="cursor:default;line-height: 10px;padding: 3px 6px;"><span class="fa fa-minus" ></span></span>';
0184                                 }*/
0185                                 
0186                             }
0187                         ?>
0188                         
0189                         <?= nl2br(Default_Model_HtmlPurify::purify($comment['comment_text']),true) ?>
0190 
0191                         </div>
0192                         <p>
0193                             <small class="small pull-right">
0194                             <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?>
0195                                 <a data-toggle="collapse" href="#reply-<?= $comment['comment_id'] ?>"><span class="glyphicon glyphicon-share-alt"></span> Reply</a>
0196                                 <span>&nbsp;</span>
0197 
0198                                 <a data-toggle="modal" data-target="#report-<?= $comment['comment_id'] ?>" role="button" href="#report-<?= $comment['comment_id'] ?>">
0199                                     <span class="glyphicon glyphicon-alert"></span> Report
0200                                 </a>
0201                             <?php }else{ ?>
0202                                 <a data-toggle="modal" data-target="#like-product-modal" role="button">
0203                                    <span class="glyphicon glyphicon-alert"></span> Report 
0204                                 </a>
0205                             <?php }?>
0206                                 
0207                             </small>
0208                         </p>
0209                         <div id="report-<?= $comment['comment_id'] ?>" class="modal" tabindex="-1" role="dialog">
0210                             <div class="modal-dialog modal-sm">
0211                                 <div class="modal-content" style="padding: 10px 10px 0 10px;">
0212                                     <div class="modal-header">
0213                                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
0214                                     </div>
0215                                     <form id="comment-report" class="full-width partialjson" action="/report/comment/" data-target="#report-<?= $comment['comment_id'] ?>-message">
0216                                         <input type="hidden" name="i" value="<?= $comment['comment_id'] ?>">
0217                                         <input type="hidden" name="p" value="<?= $this->product->project_id ?>">
0218                                         <div id="report-<?= $comment['comment_id'] ?>-message">
0219                                         <p>Do you really want to report this comment?</p>
0220                                         <div class="modal-footer">
0221                                             <button type="submit" style="border:none;background: transparent;color: #2673b0; " class="small"><span class="glyphicon glyphicon-share-alt"></span> Yes</button>
0222                                         </div>
0223                                         </div>
0224                                     </form>
0225                                 </div>
0226                             </div>
0227                         </div>
0228                         <?php if (Zend_Auth::getInstance()->hasIdentity()) { ?>
0229                         <div class="collapse" id="reply-<?= $comment['comment_id'] ?>">
0230                             <form class="full-width product-add-comment-moderation" action="/productcomment/addreply" >
0231                                 <input type="hidden" name="i" value="<?= $comment['comment_id'] ?>">
0232                                 <input type="hidden" name="p" value="<?= $comment['comment_target_id'] ?>">
0233                                 <input type="hidden" name="m" value="<?= $identity->member_id ?>">
0234                                 <input type="hidden" name="t" value="30">
0235                                 <textarea name="msg" class="full-width" required="required"></textarea>
0236                                 <button type="submit" style="border:none;background: transparent;color: #2673b0; float: right" class="small"><span class="glyphicon glyphicon-send"></span> Send</button>
0237                                 <?php //echo $captcha->render($this); ?>
0238                             </form>
0239                         </div>
0240                         
0241                         <?php } ?>
0242                     </div>
0243            </div>
0244 <?php endforeach;?>
0245             </div>
0246 
0247                     <div class="row" >
0248                         <div class="col-lg-12">
0249                         <small class="pull-right">                         
0250                         <?php if ($pageCount > 1) echo $this->paginationControl($this->comments, 'Sliding', '/partials/paginationControlComment.phtml',
0251                             array('params' => array('project_id'=>$this->product->project_id), 'dom_target' => 'div#product-comment-moderation')); ?></small>
0252                             </div>
0253                     </div>
0254         </div>
0255     </div>
0256 </div>
0257 <div class="tooltip_templates" style="display: none">
0258     <span id="tooltip_content">
0259         <i class="fa fa-spinner"></i>
0260     </span>
0261 </div>
0262 <?php $this->inlineScript()->appendScript(
0263     '    $(document).ready(function(){                      
0264             AjaxForm.setup("form.product-add-comment-moderation", "div#product-comment-moderation");                            
0265         });
0266     ');