} ?> <tr><td style="padding-left:0px;"><a href="<?php echo $this->createUrl("article", array("id" => $article['id'])); ?>" title="<?php echo $article['subject'];?>"><?php echo (strlen(strip_tags($answer['content'])) > 70) ? mb_strcut(strip_tags($article['subject']), 0, 70, 'utf-8') . "..." : $article['subject']; ?></a><span style="color:#ccc;margin-left:0;">(共<?php echo Comment::model()->count("pk_id = :pk_id and parent_id=0 and model='article'", array(":pk_id" => $article['id'])); ?>条评论)</span></td></tr> <?php } echo '</tbody></table>'; } else { echo "<div class='alert alert-info'>暂无其他文章</div>"; } ?> <fieldset> <legend style="margin-bottom: 10px;">文章状态</legend> </fieldset> <p style="color: #ccc"> <?php $commentModel = Comment::model()->find("pk_id = :pk_id and model=:model order by create_time desc", array(":pk_id" => $model->id, ":model" => "article")); ?> <span style="display: block;">最近活动于<?php echo ($commentModel == NULL) ? Comment::timeintval($model->update_time) . "修改" : Comment::timeintval($commentModel->create_time) . "评论"; ?></span> <span>被浏览<?php echo $model->view_count; ?>次</span> </p> </div> </div> </div> <script> var agreeVoteUrl = "<?php echo $this->createUrl("agreeavote"); ?>"; var disagreeVoteUrl = "<?php echo $this->createUrl("disagreevote"); ?>"; var acceptedUrl = "<?php echo $this->createUrl("acceptedanswer"); ?>"; var createReplyUrl = '<?php echo $this->createUrl("createreply"); ?>'; var deleteCommentUrl = '<?php echo $this->createUrl("deleteComment"); ?>'; var deleteReplyUrl = '<?php echo $this->createUrl("deleteReply"); ?>'; var isLogin = "******"false":"true"; ?>"; function report(pk,type){ if(isLogin=="false"){
public function renderArticleVoteDiv($data, $row) { $articleModel = Article::model()->findByPk($data->pk_id); $comment = Comment::model()->find("pk_id=:pk_id and model=:model order by create_time desc", array(":pk_id" => $articleModel->id, ":model" => "article")); $userID = $comment == NULL ? $articleModel->create_user : $comment->user_id; $avatarUrl = $this->createUrl("default/getimage", array("id" => $userID, "type" => "avatar")); $userUrl = $this->createUrl("default/userinfo", array("user_id" => $userID)); $viewUrl = $this->createUrl('default/article', array('id' => $articleModel->id)); $topicArray = array(); $topicArray = explode(",", trim($articleModel->topic_ids, ",")); for ($i = 0; $i < count($topicArray); $i++) { $topicModel = Topic::model()->findByPk($topicArray[$i]); $topicUrl = $this->createUrl('default/topic', array('id' => $topicModel->id)); $topLabel .= "<a href='" . $topicUrl . "' class='topic-label' data-id='" . $topicModel->id . "' title='" . $topicModel->name . "' style='margin-right:4px;'><span class='label'>" . $topicModel->name . "</a></a>"; } $count = Comment::model()->count("pk_id=:pk_id and model=:model and parent_id=0", array(":pk_id" => $articleModel->id, ":model" => "article")); $class = $count != 0 ? "upvote" : "upvote danger"; $desc = $comment == NULL ? Comment::timeintval($articleModel->create_time) . "发布" : Comment::timeintval($comment->create_time) . "评论"; $html = '<div class="post">'; $html .= '<a class="upvote" href="' . $viewUrl . '" target="_blank" title="' . $data->num . '个人觉得很赞" rel="tooltip"><i class="icon icon-arrow-up-2"></i><span class="vote-count">' . $data->num . '</span></a>'; $html .= '<a class="' . $class . '" href="' . $viewUrl . '" target="_blank" title="' . $count . '条评论" rel="tooltip"><i class="icon-bubble"></i><span class="vote-count">' . $count . '</span></a>'; $html .= '<a class="upvote" href="' . $viewUrl . '" target="_blank" title="' . $articleModel->view_count . '个访问量" rel="tooltip"><i class="icon-eye-2"></i><span class="vote-count">' . $articleModel->view_count . '</span></a>'; $html .= '<div class="url"><span class="ellipsis description"><a class="user-label" href="javascript:;" data-id="' . $userID . '" style="margin-right:10px;">' . User::getNameById($userID) . '</a> ' . $desc . '</span><div><a class="post-url title" href="' . $viewUrl . '" target="_blank" title="' . $articleModel->subject . '">' . $articleModel->subject . '</a>' . $topLabel . '</div></div>'; // $html .= '<a href="' . $viewUrl . '" target="_blank" class="view-discussion" title="浏览量"><i class="icon-eye-2"></i><p class="comment-count">' . $articleModel->view_count . '</p></a>'; //$html .= '<a href="' . $viewUrl . '" target="_blank" class="view-discussion" title="回答数"><i class="icon-bubble"></i><p class="comment-count">' . Comment::model()->count("pk_id=:pk_id and parent_id=0 and model=:model order by create_time desc", array(":pk_id" => $articleModel->id, ":model" => "article")) . '</p></a>'; $html .= '<div class="user-image-holder"><a class="user-label" href="javascript:;" data-id="' . $userID . '"><img alt="' . User::getNameById($userID) . ' - ' . $this->title . '" class="twitter-rounded user-image" height="30" src="' . $avatarUrl . '" width="30"></a></div>'; $html .= '</div>'; return $html; }
if ($i == 6) { break; } ?> <div class="product-comment" style="padding-left: 6px;"> <div class="comment-list clearfix"> <div class="item clearfix" style="margin-bottom: 6px;position: relative;border-bottom:1px dotted #ccc;"> <div style="width:100%;float: left;"> <div class="u-name"> <a target="_blank" href="<?php echo $this->createUrl('default/userinfo', array('user_id' => $name->user_id)); ?> "><b><?php echo User::getNameById($name->user_id); ?> </b></a> 点评 <span style="position:absolute;right:0;"><?php echo Comment::timeintval($name->create_time); ?> </span></div> <div class="small-comment ellipsis"><?php echo $name->content; ?> </div> </div> </div> </div> </div> <?php } } } elseif ($type == "hot") { ?>
<a href="javascript:;" class="msg_reply" action-type="send_private_msg" action-data-name="<?php echo $v['user_name']; ?> " action-data-id="<?php echo $v['user_id']; ?> "></a> </div> </div> <div class="msg_ctrls1" style="position: absolute; right: 0; top: 22px; height: 20px; line-height: 20px;"> <span class="T_textb"><?php echo Comment::timeintval($v['msg_create_time']); ?> </span> </div> <div class="message-opt"> <ul> <li><a href="<?php echo $v['msg_list_url']; ?> ">共<?php echo $v['msg_count']; ?> 对话</a></li> <li>|</li> <li><a href="javascript:;" name="reply" data-uid="<?php echo $v['user_id'];
} ?> <tr><td style="padding-left:0px;"><a href="<?php echo $this->createUrl("answer", array("id" => $answer['id'])); ?>"><?php echo (strlen(strip_tags($answer['content'])) > 70) ? mb_strcut(strip_tags($answer['content']), 0, 70, 'utf-8') . "..." : $answer['content']; ?></a><span style="color:#ccc;margin-left:0;">(共<?php echo Comment::model()->count("pk_id = :pk_id and parent_id=0 and model='answer'", array(":pk_id" => $answer['id'])); ?>条评论,<?php echo (Question::model()->count("answer_id=" . $answer['id']) > 0) ? "已采纳" : "未采纳"; ?>)</span></td></tr> <?php } echo '</tbody></table>'; } else { echo "<div class='alert alert-info'>暂无其他回答</div>"; } ?> <fieldset> <legend style="margin-bottom: 10px;">回答状态</legend> </fieldset> <p style="color: #ccc"> <?php $commentModel = Comment::model()->find("pk_id=:pk_id and model='answer' order by create_time desc", array(":pk_id" => $model->id)); ?> <span style="display: block;">最近活动于<?php echo ($commentModel == NULL) ? Comment::timeintval($model->create_time) : Comment::timeintval($commentModel->create_time); ?>,<?php echo (Question::model()->count("answer_id=" . $model->id) > 0) ? "已采纳" : "未采纳"; ?></span> </p> </div> </div> </div> <script> var agreeVoteUrl = "<?php echo $this->createUrl("agreeavote"); ?>"; var disagreeVoteUrl = "<?php echo $this->createUrl("disagreevote"); ?>"; var acceptedUrl = "<?php echo $this->createUrl("acceptedanswer"); ?>"; var createReplyUrl = '<?php echo $this->createUrl("createreply"); ?>'; var deleteCommentUrl = '<?php echo $this->createUrl("deleteComment"); ?>'; var deleteReplyUrl = '<?php echo $this->createUrl("deleteReply"); ?>'; $(document).ready(function() { $(document).delegate(".all", 'click', function() { $(this).parent(".vote-info").find(".vote-all").show(); $(this).parent(".vote-info").find(".vote-some").hide();
$criteria->addSearchCondition("topic_ids", "," . $data->id . ","); $questionModel = Question::model()->findAll($criteria); if (count($questionModel) > 0) { foreach ($questionModel as $key => $value) { ?> <div class="question-body"><a title="<?php echo $value->title; ?> " href="<?php echo $this->createUrl("question", array('id' => $value->id)); ?> "><?php echo $value->title; ?> </a><span style="margin-left:10px;color:#ccc;"><?php echo Comment::timeintval($value->create_time); ?> ,<?php echo $value->answer_id != 0 ? "已解决" : "待解决"; ?> </span></div> <?php } } else { echo "暂无问题"; } ?> </div> </div> </div> <hr style="border-style: dotted ">
?> </a> <span class="pull-right"> <?php if ($commentCount > 0) { $commentModel = Comment::model()->find("pk_id=:pk_id and model=:model and parent_id=0 order by create_time desc", array(":model" => "answer", ":pk_id" => $answerModel->id)); ?> <a class="user-label" href="javascript:;" data-id="<?php echo $commentModel->user_id; ?> "><?php echo User::getNameById($commentModel->user_id); ?> </a> <?php echo Comment::timeintval($commentModel->create_time) . "评论"; ?> <?php } else { echo "暂无评论"; } ?> </span> </p> <?php } ?> </div> </div> </div> </div>
<div class="clearfix box-section" style="width:94%;float: right;"> <div class="clearfix right popover-style" style="display:block;left:0;clear:both;right:0;position: relative;"> <div class="comment-arrow" style="top:20px;"></div> <div class="popover-content"> <div class="o-topic clearfix" style="border-bottom:1px solid #ccc;"> <span class="pull-left"><a class="user-label" data-id="<?php echo $data->user_id; ?> " target="_blank" href="<?php echo $this->createUrl('default/userinfo', array('user_id' => $data->user_id)); ?> "><b><?php echo User::getNameById($data->user_id); ?> </b></a></span><span class="pull-right"><?php echo Comment::timeintval($data->create_time); ?> </span></div> <p class="comment-content"><?php echo $data->content; ?> </p> <p class="comment-content clearfix"> <?php if (Yii::app()->user->name == "admin" || $data->model == "comment" && $data->pk_id == Yii::app()->user->id || Comment::model()->getIsCreateUser($data->pk_id, $data->model)) { ?> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => '删除', 'size' => 'small', 'icon' => 'icon-remove-2', 'block' => true, 'buttonType' => 'link', 'url' => '', 'htmlOptions' => array('style' => 'width:70px;float:right;margin-left:10px;margin-top:0 !important;', 'data-name' => Yii::app()->user->isGuest ? 'noLogin' : 'delete-comment', "data-value" => $data->id))); ?> <?php }
public function getLastAnswer() { $answer = Answer::model()->find("question_id=:question_id order by create_time desc", array(":question_id" => $this->id)); $date = $answer != null ? $answer->create_time : $this->create_time; return Comment::timeintval($date); }
?> "> <span class="user-name"><?php echo User::getNameById($data->from_user); ?> </span> </a> <?php if ($this->getAction()->getId() == "personal" || $this->getAction()->getId() == "userinfo" && $data->from_user == Yii::app()->user->id) { ?> <a class="remove-visit icon-close-2" action-type="delVisit" action-data-id="<?php echo $data->id; ?> " href="javascript:;" title="删除"></a> <?php } ?> </div> <div class="name"> <a title="<?php echo User::getNameById($data->from_user) . " - " . $this->title; ?> " target="_blank" href="<?php echo $this->createUrl('default/userinfo', array('user_id' => $data->from_user)); ?> "><?php echo Comment::timeintval($data->create_time, 'n月j日'); ?> </a> </div> </div>
} ?> <tr><td style="padding-left:0px;"><a title="<?php echo $questionModel->title; ?>" href="<?php echo $this->createUrl("question", array("id" => $questionModel->id)); ?>"><?php echo $questionModel->title; ?></a><span style="color:#ccc;margin-left:0;">(共<?php echo Answer::model()->count("question_id = :question_id",array(":question_id"=>$questionModel->id)); ?>个回答,<?php echo (Question::model()->count("answer_id=".$questionModel->id)>0) ? "已解决":"待解决"; ?>)</span></td></tr> <?php } echo '</tbody></table>'; }else{ echo "<div class='alert alert-info'>暂无相似问题</div>"; } ?> <fieldset> <legend style="margin-bottom: 10px;">问题状态</legend> </fieldset> <p style="color: #ccc"> <?php $answerModel = Answer::model()->find("question_id = :question_id order by create_time desc",array(":question_id"=>$model->id));?> <span style="display: block;">最近活动于<?php echo ($answerModel==NULL) ? Comment::timeintval($model->update_time): Comment::timeintval($answerModel->create_time);?>,<?php echo $model->answer_id!=0 ? "已解决":"待解决"; ?></span> <span>被浏览<?php echo $model->view_count;?>次</span> </p> </div> </div> </div> <?php if (!Yii::app()->user->isGuest) { ?> <?php $this->beginWidget('bootstrap.widgets.TbModal', array('id' => 'helpModal', 'options' => array("backdrop" => 'static'), 'fade' => false)); ?> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h4 class="modal-title">邀请</h4> </div> <div class="modal-body clearfix" style="overflow-y: visible;"> <?php $this->renderPartial('../_askforhelpform',array('question'=>$model)); ?> </div> <div class="modal-footer" style="text-align: center;">
public static function replyList($array, $padding = 60, $left = 20) { if (empty($array)) { return false; } foreach ($array as $key) { $result .= '<a name="sys_comment_' . $key['id'] . '"></a>'; $result .= '<div class="comment-reply" style="border-top:1px dashed #ccc;position:relative;padding:10px 0 10px 60px;padding-left:' . $padding . 'px;"><a href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['reply_user'])) . '" class="user-label" data-id="' . $key['reply_user'] . '" target="_blank" style="font-weight:bold;"><img src="' . Yii::app()->controller->createUrl('default/getimage', array('id' => $key['create_user'], 'type' => 'avatar')) . '" width="34" height="34" style="border:none;position: absolute;left:' . $left . 'px;top: 10px;"></a>' . ' <div><a href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['reply_user'])) . '" class="user-label" data-id="' . $key['reply_user'] . '" target="_blank" style="font-weight:bold;">' . User::getNameById($key["reply_user"]) . '</a> 回复 <a href="' . Yii::app()->controller->createUrl('default/userinfo', array('user_id' => $key['create_user'])) . '" class="user-label" data-id="' . $key['create_user'] . '" target="_blank" style="font-weight:bold;">' . User::getNameById($key["create_user"]) . '</a> :' . $key['content'] . '<a class="pull-right reply" style="padding-right:16px;display:none;" id="' . $key["id"] . '">回复</a>'; $result .= "<div>" . Comment::timeintval($key['create_time']); if (Yii::app()->user->name == "admin" || $key['model'] == "comment" && $key['pk_id'] == Yii::app()->user->id || Comment::model()->getIsCreateUser($key['pk_id'], $key['model'])) { $result .= '<a href="#" title="删除" data-name="' . (Yii::app()->user->isGuest ? 'noLogin' : 'delete-reply') . '" data-value="' . $key['id'] . '" style="float:right;margin-right:20px;display: none;">删除</a>'; } if ($key['model'] != "comment" || $key['model'] == "comment" && $key['pk_id'] == Yii::app()->user->id && Yii::app()->controller->getAction()->getId() == "personal") { $result .= '<a user-value="' . $key['create_user'] . '" data-value="' . $key['id'] . '" data-page="' . $_GET["page"] . '" href="" title="回复" name-value="' . User::getNameById($key['create_user']) . '" data-name="' . (Yii::app()->user->isGuest ? 'noLogin' : 'reply-comment') . '" style="float:right;margin-right:20px;display: none;">回复</a>'; } $result .= '</div>'; $result .= "</div></div>"; $result .= self::replyList($key["chrildren"], $padding > 100 ? $padding : $padding + 40, $left > 80 ? $left : $left + 40); } return $result; }
"></i></a> <a href="<?php echo $this->createUrl("question", array("id" => $value->id)); ?> " title="<?php echo $value->title . " - " . $this->title; ?> "><?php echo $value->title; ?> </a> <span class="info"> <?php $answer = Answer::model()->find("question_id=:question_id order by create_time desc", array(":question_id" => $value->id)); $userID = $answer == NULL ? $value->create_user : $answer->create_user; $desc = $answer == NULL ? "提问于 " . Comment::timeintval($value->create_time) : "回答于 " . Comment::timeintval($answer->create_time); ?> <a href="javascript::" class="user-label" data-id="<?php echo $userID; ?> "><?php echo User::getNameById($userID); ?> </a> <?php echo $desc; ?> <span class="dot">•</span><?php echo $value->answer_id != 0 ? "已解决" : "未解决"; ?> </span> <span class="stat"><?php
<a class="pull-left user-label" data-id="<?php echo $data->user_id; ?> " target="_blank" href="<?php echo $this->createUrl('default/userinfo', array('user_id' => $data->user_id)); ?> "><b><?php echo User::getNameById($data->user_id); ?> </b></a> <span class="pull-left star-pic sa<?php echo $data->score; ?> "></span> <span class="pull-right"><?php echo $_GET["type"] == "new" ? Comment::timeintval($data->create_time) : date('Y-m-d H:i:s', $data->create_time); ?> </span></div> <?php if ($data->tags != "") { ?> <p class="comment-tags" style="padding-top:10px;"><span class="comment-label"><b>标签:</b></span> <?php $tags = array(); $tags_array = explode(",", $data->tags); for ($i = 0; $i < count($tags_array); $i++) { $tags = Article::model()->addQuery($_GET["tags"], $tags_array[$i]); ?> <span class='label <?php echo in_array($tags_array[$i], explode(",", $_GET["tags"])) ? "label-info" : ""; ?>
" target="_blank" rel="tooltip" title="在新窗口打开"><i class="icon-file-4"></i></a> <a href="<?php echo $this->createUrl("article", array("id" => $value->id)); ?> " title="<?php echo $value->subject . " - " . $this->title; ?> "><?php echo $value->subject; ?> </a> <span class="info"> <?php $comment = Comment::model()->find("pk_id=:pk_id and model='article' order by create_time desc", array(":pk_id" => $value->id)); $userID = $comment == NULL ? $value->create_user : $comment->user_id; $desc = $comment == NULL ? "发表于 " . Comment::timeintval($value->create_time) : "评论于 " . Comment::timeintval($comment->create_time); ?> <a href="javascript::" class="user-label" data-id="<?php echo $userID; ?> "><?php echo User::getNameById($userID); ?> </a> <?php echo $desc; ?> </span> <span class="stat"><?php echo $value->view_count; ?> 浏览 / <?php