|
@@ -21,20 +21,20 @@ class tpl_group_home
|
|
|
private $mod_room = null;
|
|
|
private $room_info = null;
|
|
|
private $cur_user = 0;
|
|
|
- private $room_id = 0;
|
|
|
+ private $room_id = 0;
|
|
|
private $participants = [];
|
|
|
|
|
|
public function __construct($user, $room_id)
|
|
|
{
|
|
|
- if($room_id <= 0){
|
|
|
+ if ($room_id <= 0) {
|
|
|
throw new Exception("聊天参数有误");
|
|
|
}
|
|
|
$this->mod_room = Model('room');
|
|
|
$this->room_id = $room_id;
|
|
|
$this->cur_user = intval($user);
|
|
|
$room = $this->mod_room->getRoom($room_id);
|
|
|
- if(!empty($room)) $this->room_info = new room_info($room);
|
|
|
- if(empty($this->room_info)){
|
|
|
+ if (!empty($room)) $this->room_info = new room_info($room);
|
|
|
+ if (empty($this->room_info)) {
|
|
|
throw new Exception("聊天参数有误");
|
|
|
}
|
|
|
$this->participants = factory::participants($this->room_id);
|
|
@@ -43,7 +43,7 @@ class tpl_group_home
|
|
|
public function show_cover()
|
|
|
{
|
|
|
$html = "";
|
|
|
- $url = RESOURCE_SITE_URL. "/mobile/talk/images/cover.png";
|
|
|
+ $url = RESOURCE_SITE_URL . "/mobile/talk/images/cover.png";
|
|
|
$html .= "
|
|
|
<div class=\"cover\">
|
|
|
<img src=\" {$url} \" alt=\"cover\">
|
|
@@ -55,13 +55,12 @@ class tpl_group_home
|
|
|
public function show_group_header()
|
|
|
{
|
|
|
$html = '';
|
|
|
- if (!empty($this->room_info))
|
|
|
- {
|
|
|
+ if (!empty($this->room_info)) {
|
|
|
|
|
|
$name = $this->room_info->has_name();
|
|
|
- if($name){
|
|
|
+ if ($name) {
|
|
|
$name = $this->room_info->name();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$name = "未命名";
|
|
|
}
|
|
|
|
|
@@ -74,10 +73,13 @@ class tpl_group_home
|
|
|
</div>
|
|
|
<div class=\"group_name\">
|
|
|
<h3>{$name}</h3>
|
|
|
+ <span class=\"certification_logo\"></span>
|
|
|
<p>{$desc}</p>
|
|
|
- </div>
|
|
|
- <div class='qrcode_btn'></div>
|
|
|
- ";
|
|
|
+ </div>";
|
|
|
+
|
|
|
+ if(isset($this->participants[$this->cur_user])){
|
|
|
+ $html.=" <div class='qrcode_btn'></div>";
|
|
|
+ }
|
|
|
}
|
|
|
echo $html;
|
|
|
}
|
|
@@ -85,20 +87,16 @@ class tpl_group_home
|
|
|
public function show_group_notice()
|
|
|
{
|
|
|
$html = "";
|
|
|
- if (!empty($this->room_info))
|
|
|
- {
|
|
|
+ if (!empty($this->room_info)) {
|
|
|
$notice = $this->room_info->notice();
|
|
|
|
|
|
- if(empty($notice))
|
|
|
- {
|
|
|
- $html.= "
|
|
|
+ if (empty($notice)) {
|
|
|
+ $html .= "
|
|
|
<div class=\"group_notice_board\" style=\"display: none;\">
|
|
|
<p class=\"text_overflow\"></p>
|
|
|
</div>";
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $html.= "
|
|
|
+ } else {
|
|
|
+ $html .= "
|
|
|
<div class=\"group_notice_board\">
|
|
|
<p class=\"text_overflow\">【公告】{$notice}</p>
|
|
|
</div>";
|
|
@@ -108,38 +106,58 @@ class tpl_group_home
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
- private function isManager($user) {
|
|
|
+ public function show_group_activity()
|
|
|
+ {
|
|
|
+ $html = "";
|
|
|
+ if(isset($this->participants[$this->cur_user])){
|
|
|
+ $html.= "<div class=\"group_handle weui-flex\">
|
|
|
+ <div class=\"weui-flex__item group_bonus\">
|
|
|
+ <a href=\"/mobile/index.php?act=member_talk&op=share_bonus&room_id={$this->room_id}\">
|
|
|
+ <img src=\"<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/group_bonus.png\" alt=\"\">
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-flex__item group_goods\">
|
|
|
+ <img src=\"<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/group_goods.png\" alt=\"\">
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-flex__item group_sport\">
|
|
|
+ <img src=\"<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/images/group_sport.png\" alt=\"\">
|
|
|
+ </div>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ echo $html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private function isManager($user)
|
|
|
+ {
|
|
|
return intval($user) === $this->room_info->owner();
|
|
|
}
|
|
|
|
|
|
public function show_members()
|
|
|
{
|
|
|
$html = '';
|
|
|
- if (!empty($this->participants))
|
|
|
- {
|
|
|
+ if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
+ $html.="<div class=\"group_members weui-flex\">";
|
|
|
+
|
|
|
$i = 1;
|
|
|
$cnt = count($this->participants);
|
|
|
- foreach ($this->participants as $uids => $member)
|
|
|
- {
|
|
|
- if($i < $cnt) {
|
|
|
+ foreach ($this->participants as $uids => $member) {
|
|
|
+ if ($i < $cnt) {
|
|
|
$div_head = "<div class=\"weui-flex__item\" data-member-id={$member['userid']}>";
|
|
|
} else {
|
|
|
$div_head = "<div class=\"weui-flex__item\" data-member-id={$member['userid']} data-last='true'> ";
|
|
|
}
|
|
|
|
|
|
- if($this->isManager($uids))
|
|
|
- {
|
|
|
+ if ($this->isManager($uids)) {
|
|
|
$head = "
|
|
|
<img src=\"{$member['avatar']}\" alt=\"\">
|
|
|
<p>{$member['nickname']}</p>
|
|
|
<span class=\"admin\">管理员</span>
|
|
|
</div>";
|
|
|
|
|
|
- $html = $div_head.$head.$html;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $html .=$div_head;
|
|
|
+ $html = $div_head . $head . $html;
|
|
|
+ } else {
|
|
|
+ $html .= $div_head;
|
|
|
$html .= "
|
|
|
<img src=\"{$member['avatar']}\" alt=\"\">
|
|
|
<p>{$member['nickname']}</p>
|
|
@@ -149,17 +167,16 @@ class tpl_group_home
|
|
|
$i++;
|
|
|
}
|
|
|
|
|
|
+ $html.="</div>";
|
|
|
}
|
|
|
|
|
|
- if (isset($this->participants[$this->cur_user]))
|
|
|
- {
|
|
|
+ if (isset($this->participants[$this->cur_user])) {
|
|
|
$html .= "<div class=\"weui-flex__item\">
|
|
|
<img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/add_member.png\" id=\"add_member\" alt=\"\">
|
|
|
</div>";
|
|
|
}
|
|
|
|
|
|
- if ($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
$html .= "<div class=\"weui-flex__item\">
|
|
|
<img src=\"" . RESOURCE_SITE_URL . "/mobile/talk/images/del_member.png\" id=\"del_member\" alt=\"\">
|
|
|
</div>";
|
|
@@ -171,19 +188,18 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = "";
|
|
|
|
|
|
- if (!empty($this->room_info))
|
|
|
- {
|
|
|
+ if (!empty($this->room_info) && isset($this->participants[$this->cur_user])) {
|
|
|
$avartar = $this->room_info->avatar();
|
|
|
- $name = $this->room_info->has_name();
|
|
|
- if($name){
|
|
|
+ $name = $this->room_info->has_name();
|
|
|
+ if ($name) {
|
|
|
$name = $this->room_info->name();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$name = "未命名";
|
|
|
}
|
|
|
|
|
|
$notice = empty($this->room_info->notice()) ? "未设置" : "已设置";
|
|
|
- $desc = empty($this->room_info->room_desc()) ? "未设置" : "已设置";
|
|
|
- $level = $this->room_info->level() == 0 ? "未认证" : "已认证";
|
|
|
+ $desc = empty($this->room_info->room_desc()) ? "未设置" : "已设置";
|
|
|
+ $level = $this->room_info->level() == 0 ? "未认证" : "已认证";
|
|
|
|
|
|
$html .= "
|
|
|
<a class=\"weui-cell weui-cell_access\" id='edit_group_name' href=\"javascript:;\">
|
|
@@ -211,9 +227,8 @@ class tpl_group_home
|
|
|
</a>";
|
|
|
}
|
|
|
|
|
|
- if($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
- $html .= "<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_notice\">
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
+ $html .= "<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"edit_room_notice\">
|
|
|
<div class=\"weui-cell__bd\">
|
|
|
<p>群公告</p>
|
|
|
</div>
|
|
@@ -233,8 +248,7 @@ class tpl_group_home
|
|
|
{
|
|
|
$html = "";
|
|
|
|
|
|
- if(!empty($this->participants))
|
|
|
- {
|
|
|
+ if (!empty($this->participants) && isset($this->participants[$this->cur_user])) {
|
|
|
$html .= "
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='edit_nickname'>
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -244,8 +258,7 @@ class tpl_group_home
|
|
|
</a>";
|
|
|
}
|
|
|
|
|
|
- if($this->isManager($this->cur_user))
|
|
|
- {
|
|
|
+ if ($this->isManager($this->cur_user)) {
|
|
|
$html .= "
|
|
|
<a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id='change_owner' >
|
|
|
<div class=\"weui-cell__bd\">
|
|
@@ -257,6 +270,49 @@ class tpl_group_home
|
|
|
echo $html;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public function show_group_footer()
|
|
|
+ {
|
|
|
+ $html = "";
|
|
|
+ if(isset($this->participants[$this->cur_user]))
|
|
|
+ {
|
|
|
+ $html .="<div class=\"weui-cells\">
|
|
|
+ <div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>置顶聊天</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"talk_top\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"talk_top\" class=\"weui-switch-cp__input\" type=\"checkbox\">
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell weui-cell_switch\" href=\"javascript:;\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>消息免打扰</p>
|
|
|
+ </div>
|
|
|
+ <div class=\"weui-cell__ft\">
|
|
|
+ <label for=\"no_disturb\" class=\"weui-switch-cp\">
|
|
|
+ <input id=\"no_disturb\" class=\"weui-switch-cp__input\" type=\"checkbox\">
|
|
|
+ <div class=\"weui-switch-cp__box\"></div>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class=\"weui-cells\">
|
|
|
+ <a class=\"weui-cell weui-cell_access\" href=\"javascript:;\" id=\"hide_msg\">
|
|
|
+ <div class=\"weui-cell__bd\">
|
|
|
+ <p>清空聊天记录</p>
|
|
|
+ </div>
|
|
|
+ </a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ echo $html;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public function show_footer_btn()
|
|
|
{
|
|
|
$html = "";
|
|
@@ -276,7 +332,23 @@ class tpl_group_home
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //todo 申请加入此群按钮
|
|
|
+ $pwd = "";
|
|
|
+ if($pwd){
|
|
|
+ $html .= "
|
|
|
+ <div class=\"quit\" id=\"add_group\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">密码入群</a>
|
|
|
+ </div>
|
|
|
+ <div class=\"quit\" id=\"add_group\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">申请加群</a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $html .= "
|
|
|
+ <div class=\"quit\" id=\"add_group\">
|
|
|
+ <a href=\"javascript:;\" class=\"weui-btn weui-btn_primary\">立即入群</a>
|
|
|
+ </div>";
|
|
|
+ }
|
|
|
}
|
|
|
echo $html;
|
|
|
}
|