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