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