Tiaxgame.Tk
Trang chủ | Forum | Register Wap4.Co Free
Đăng Nhập » Đăng Ký
ForumWap4 Việt NamShare Code
Lượt xem: 102

▼ Code group chat forum tiaxgame

* nhokdung  (Member) [Off]
30 * 17
*   Cách đây 1 tháng
Chào ae code phòng chat thêm thành viên vài như một chức năng hội nhóm

chức năng

Tạo phòng chat

Kick thành viên
Thêm thành viên
Rời nhóm

Giải tán phòng xóa tất cả liên quan đến phòng chat


thêm.thành viên nhập dạng nick1,nick2,nick3, xong vào phòng có thêm.nick nhập mỗi nick lần lượt là được nhá



Demo myavatar.viwap.com/group

Tạo tối đa 3 phòng chat

Code đã mod tiết kiệm data kô lo nhá


Cuối cùng là code.


[php]
{%import 'funcc.twig' as m%}
{%import 'func.twig' as k%}
{%from 'time.twig' import ago%}
{%use '_blocks'%}{%set uri=get_uri_segments()%}
{%set sign=k.login()|trim%}
{%if sign%}
{%if get_data_count('groupchat')==0%}
{%set e=save_data('groupchat',[]|json_encode)%}
{%endif%}


{%if get_data_count('bold')==0%}
{%set ee=save_data('bold',[]|json_encode)%}
{%endif%}
{#{block("header")}#}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta
http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta
name="viewport" content="width=device-width,maximum-scale=1,user-scalable=no"/><meta
http-equiv="X-UA-Compatible" content="IE=edge"><meta
name="viewport" content="width=device-width, initial-scale=1"><title>Message - {{sign}}</title><meta
name="description" content="MXH TeaMobi - Mạng xã hội dành cho di động lớn nhất việt nam" /><link
rel="icon" href='http://my.teamobi.com/favicon.ico' type="image/x-icon" /><link
rel="apple-touch-icon" href="http://my.teamobi.com/logo256.png" /><link
rel="shortcut icon" href='http://my.teamobi.com/favicon.ico' type="image/x-icon" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/bootstrap.min.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/font-awesome/css/font-awesome.min.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/bootstrap-growl.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/style.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/emoji.css" /><link
rel="stylesheet" href="http://mervick.github.io/lib/emojione/assets/sprites/emojione.sprites.css" /><link
rel="stylesheet" type="text/css" href="http://mervick.github.io//lib/emojionearea/2.1.3/css/emojionearea.css" media="screen"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/google-code-prettify/prettify.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/emojione/lib/js/emojione.min.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/emojionearea/2.1.3/js/emojionearea.js"></script> </head><body>
<audio
id="chatAudio">
<source
src="http://my.teamobi.com/beta/notify.mp3" type="audio/mpeg"></audio><div
class="container-semifluid"><div
class="container" ><div
class="box_welcome_team pull-right" ></div>
<a
class="pull-left" style="margin: 8px 3px 0px 0px;" href="/home?act">
<img
src="http://my.teamobi.com/app/view/images/logo.png" height=30px /></a></div><div
class=body><div
class="container"><div
class="bg-content"><div
id="box_login_ads"><div
align="center" style="padding-bottom:5px;"></div></div><ol
class="breadcrumb"><li><a
href="/">MXH TeaMobi</a></li><li><a
href="/group/group-message">Phòng chat</a></li><li
class="active">{{get_data('groupchat')[0].data|json_decode['data'~uri[2]].title|default("Tạo phòng chat mới")}}</li></ol>


{%if uri[1]=="new-group-message" %}

{%if k.get('groups_'~sign)|split("@")|length-1>3 %}Tối đa 3 phòng chat {%else%}
{%set tt=get_data('groupchat')[0].data|json_decode%}

{%if get_post("name")!="" and get_post("message")!="" and get_post("sendmessage")!=""%}





{%set tiem={"nick":k.login()|trim,"user":k.login()|trim,"title":get_post("name"),"nd":get_post("message"),"time":"now"|date('U'),"act":"yes","action":"yes","rand":random(100),"uid":(tt['dem']|trim+1),"nickadd":get_post("user_arr")|default("")}%}


{{m.up('groups_'~k.login()|trim,tt['dem']|trim+1,'up')}}
{{k.add('groupchat','data'~(tt['dem']|trim+1),tiem)}}
{{k.add('groupchat','dem',tt['dem']|trim+1)}}
<script>document.location="/group"</script>
{%endif%}

<div style="padding-left:10px">
<form
method="POST"><div
class="form-group">
<label
for="exampleInputname">Tên phòng chat</label><p
class="help-block"><small>(Tối đa 100 ký tự)</small></p>
<input
type="text" name="name" class="form-control" id="exampleInputname" value="" maxlength="100" placeholder="Tên phòng chat"></div><div
class="form-group">
<label
for="exampleInputuser">Danh sách thành viên</label><p
class="help-block"><small>(Nhập dạng User1, User2, User3)</small></p>
<input
type="text" name="user_arr" class="form-control" id="exampleInputuser" value="" placeholder="Danh sách thành viên"></div>


<p><div
class="input-group"><textarea name="message" class="form-control" id="contentArea"></textarea><span
class="input-group-addon" id="popover-with-html">
</span></div></p><p
style="text-align:center;"><button
name="sendmessage" type="submit" value="submit" class="btn btn-success" style="width:100%;">Gửi</button></p></form>
</div>

{%endif%}




{#rời phòng#}

{%elseif get_get("do")=="exit" and get_get("uid") and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign in get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nickadd|split(",")%}
{%set er=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}
{{m.del('groups_'~sign,get_get("uid"),'up')}}

{{k.add('groupchat','data'~get_get("uid"),{"nick":er.nick,"user":er.user,"act":er.act,"action":er.action,"time":er.time,"nickadd":er.nickadd|replace({(sign)~',':""}),"title":er.title,"nd":er.nd,"rand":er.rand,"uid":er.uid})}}

<script>document.location="/group/group-message/{{get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid}}"</script>


{#del phòng#}

{%elseif get_get("do")=="out-group" and get_get("uid") and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign==get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nick%}

{%set z=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}

{%set ck=get_data('bold')[0].data|json_decode['data'~get_get("uid")]%}

{{k.add('groupchat','data'~get_get("uid"),{"nick":null,"user":null,"act":null,"action":null,"time":null,"nickadd":null,"title":null,"nd":null,"rand":null,"uid":null})}}
{{m.del('groups_'~k.login()|trim,get_get("uid"),'up')}}
{{m.del('page_'~get_get("uid"))}}





<script>document.location="/group/group-message/{{get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid}}"</script>


{#kick tv#}
{%elseif get_get("do")=="kickgroup" and get_get("uid") and k.get('id_'~get_get("id")) and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign==get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nick%}
{%set kik=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}

{{m.del('groups_'~k.get('id_'~get_get("id")),get_get("uid"),'up')}}

{{k.add('groupchat','data'~get_get("uid"),{"nick":kik.nick,"name":kik.name,"user":kik.user,"time":kik.time,"action":kik.action,"act":kik.act,"nd":kik.nd,"title":kik.title,"rand":kik.rand,"uid":kik.uid,"nickadd":kik.nickadd|replace({(k.get('id_'~get_get("id")))~',':""})})}}



{#chat phòng#}

{%elseif uri.1=="group-message" and uri.2 and get_data('groupchat')[0].data|json_decode['data'~uri[2]].uid and k.login()|trim==get_data('groupchat')[0].data|json_decode['data'~uri[2]].nick or uri.1=="group-message" and uri.2 and get_data('groupchat')[0].data|json_decode['data'~uri[2]].uid and k.login()|trim in get_data('groupchat')[0].data|json_decode['data'~uri[2]].nickadd|split(",") %}{%set vv=get_data('groupchat')[0].data|json_decode['data'~uri[2]]%}

{%if get_post("adduser")!="" and get_data_count('user_'~get_post("adduser"))>0 %}
{%if get_post("adduser") in vv.nickadd|split(',')%}
<br>Thêm thành viên {{get_post("adduser")}} thất bại<br>
{%else%}
{{m.up('groups_'~get_post("adduser"),uri[2],'up')}}

{{m.up('tb_open_'~get_post("adduser"),'group-'~get_post("adduser")~'-'~sign~'-'~uri[2]~'-'~"now"|date('U'),'up')}}
<br>thêm thành viên {{get_post("adduser")}} thành công<br>
{{k.add('groupchat','data'~uri[2],{"nick":vv.nick,"user":vv.user,"time":vv.time,"act":vv.act,"action":vv.action,"title":vv.title,"nd":vv.nd,"rand":vv.rand,"uid":vv.uid,"nickadd":vv.nickadd~get_post("adduser")~','})}}
<script>document.location=""</script>


{%endif%}

{%endif%}

{%if get_post("reply")!="" %}<script>document.location=""</script>
{%set f=get_data('bold')[0].data|json_decode%}
{{m.up('page_'~vv.uid,(f['dem']|trim+1),'up')}}
{{k.add('bold','data'~(f['dem']|trim+1),{"nick":sign,"name":sign,"title":get_post("reply"),"action":"yes","time":"now"|date('U'),"uid":(f['dem']|trim+1)})}}
{{k.add('bold','dem',f['dem']|trim+1)}}

{%endif%}

<div>
<form method="post">
<p><div
class="input-group"><textarea name="reply" class="form-control" id="contentArea"></textarea><span
class="input-group-addon" id="showsmile" data-toggle="collapse" data-target="#emoticons">
<span
class="fa fa-smile-o"></span>
</span></div></p><p
style="text-align:center;"><button
name="sendmessage" class="btn btn-success" style="width:100%;"><span
class="glyphicon glyphicon-send"></span></button></p></form><p><span
class="btn btn-default btn-xs" data-toggle="collapse" data-target="#listtv" onclick="myFunction()">
Danh sách thành viên
</span> {%if sign==vv.nick%}<a
onclick="return confirm('Giải tán phòng? Sẽ xóa tất cả tin nhắn trong phòng chat')" href="/group?do=out-group&uid={{vv.uid}}" class="btn btn-danger btn-xs">Giải tán phòng</a>{%elseif sign in vv.nickadd|split(",")%}<a
onclick="return confirm('Bạn chắc chắn muốn thoát phòng?')" href="/group?do=exit&uid={{vv.uid}}" class="btn btn-danger btn-xs">Thoát khỏi phòng</a>{%endif%}</p><div style="display:none" id="panel"
class="alert alert-info"><small>
Chủ phòng: <a><b>{{k.get('user_'~vv.nick,'nick')}}</b></a> - Thành viên: {%for r in vv.nickadd|split(",")%}{%if loop.last==false%}
<a>{{r|trim}}</a> <a
href="/group/?do=kickgroup&uid={{vv.uid}}&id={{k.get('user_'~r|trim,'id')}}" onclick="return confirm('Bạn có muốn kick thành viên này?')"><span
style="font-size: 9px;">kick</span></a>,{%endif%}{%endfor%}
</small><div><form
method="post" class="form-inline">
<input
type="text" class="form-control" name="adduser" placeholder="Thêm thành viên"> <button
class="btn btn-default" type="submit" >Thêm</button>
</form></div></div></div>


<ul
class="list-group" id="listgroup">

{%for t in k.get('page_'~vv.uid)|split("@")%}
{%set tv=get_data('bold')[0].data|json_decode['data'~t|trim]%}{%if loop.last==false%}
{#%if vv.uid in t|trim%#}
<li
class="list-group-item" id="{{tv.uid}}">
<span
class="pull-right"><a
href="/user?for=user&do=detail&uid={{k.get('user_'~tv.nick,'id')}}">
<img
class="thumbnail" height="30px" src="{{k.get('user_'~tv.nick,'icon')}}"/>
</a></span><h5 class="list-group-item-heading box_oxx_{{k.get('user_'~tv.nick,'level')}}">
<img
style="vertical-align:middle;" src="/images/online.png" border="0" />
<a
href="/user?for=user&do=detail&uid={{k.get('user_'~tv.nick,'id')}}">{{k.get('user_'~tv.nick,'nick')}}</a>
<small><i><span
class="timeago">{{ago(tv.time)}}</span>
</i></small></h5><p
class="list-group-item-text">{{tv.title|striptags}}</p></li>
{#%endif%#}{%endif%}
{%endfor%}
</ul>

{#danh sách phòng chat#}


{%else%}


<p><a
class="btn btn-info" href="/group/new-group-message" >Tạo phòng</a></p>
<div><ul
class="pagination"></ul></div>
{%for i in k.get('groups_'~k.login()|trim)|split("@")%}{%set nchat=get_data('groupchat')[0].data|json_decode['data'~i|trim]%}{%if loop.last==false%}

{%for entry in nchat.nickadd|split(',')%}{%if loop.last==false and entry != nchat.nick%}
{{m.up('tb_open_'~entry|trim,'group-'~entry|trim~'-'~sign~'-'~i|trim~'-'~"now"|date('U'),'up')}}{%endif%}

{%endfor%}

<div
class="list-group">
<small>
<a
href="/group/group-message/{{nchat.uid}}" class="list-group-item "><h4 class="list-group-item-heading box_">
{{nchat.title|striptags}} - {{k.get('user_'~nchat.nick,'nick')}}</h4><p
class="list-group-item-text"><img
src="http://my.teamobi.com/beta/app/images/reply.png" /> {{nchat.nd|striptags}}</p><p
class="alert alert-info"><small><b>Thành viên:</b>
{%for v in nchat.nickadd|split(",")%}
{{v|trim}}{%if loop.last==false%},{%endif%}{%endfor%}</small></p>
<small><i><span
class="timeago">{{ago(nchat.time)}}</span></i></small>
</a></small></div>
{%endif%}
{%endfor%}
{%endif%}
<div><ul
class="pagination"></ul></div></div></div></div><div
class="navbar-fixed-bottom scrollup" style="margin:10px;width: 30px;">
<a
href="#" style="font-size: 30px;"><i
class="glyphicon glyphicon-upload"></i></a></div><div
class="blog-footer"><div
class="row"><div
align="center">
TeaMobi @2014<center><br></center>

<script>
function myFunction() {
document.getElementById("panel").style.display = "block";
}
</script>
</div></div></div> </body></html></body></html>
{%endif%}
[/php]

Ae thay css nếu thích nhá , bye ace ...
Edited by: nhokdung
[Like=1] khanh
* nhokdung  (Member) [Off]
30 * 17
*   Cách đây 1 tháng
Code viết từ hôm qua giờ mới xong ae ạ demo myavatar.viwap.com/group mời ae qua test ạ
* copecute  (Member) [Off]
10 * 16
*   Cách đây 1 tháng
bác cho e xin funcc.twig với
* Tuankill  (Member) [Off]
187 * 354
*   Cách đây 1 tháng
Chiểu nay share nhiều code nhỉ
* nhokdung  (Member) [Off]
30 * 17
*   Cách đây 1 tháng
Update bản hoàn chỉnh fix lỗi kick tv mà một số lỗi


Bản này test ngon hơn rồi ok
Ae

[php]
{%import 'funcc.twig' as m%}
{%import 'func.twig' as k%}
{%from 'time.twig' import ago%}
{%use '_blocks'%}{%set uri=get_uri_segments()%}
{%set sign=k.login()|trim%}
{%if sign%}
{%if get_data_count('groupchat')==0%}
{%set e=save_data('groupchat',[]|json_encode)%}
{%endif%}


{%if get_data_count('bold')==0%}
{%set ee=save_data('bold',[]|json_encode)%}
{%endif%}
{#{block("header")}#}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><meta
http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta
name="viewport" content="width=device-width,maximum-scale=1,user-scalable=no"/><meta
http-equiv="X-UA-Compatible" content="IE=edge"><meta
name="viewport" content="width=device-width, initial-scale=1"><title>Message - {{sign}}</title><meta
name="description" content="MXH TeaMobi - Mạng xã hội dành cho di động lớn nhất việt nam" /><link
rel="icon" href='http://my.teamobi.com/favicon.ico' type="image/x-icon" /><link
rel="apple-touch-icon" href="http://my.teamobi.com/logo256.png" /><link
rel="shortcut icon" href='http://my.teamobi.com/favicon.ico' type="image/x-icon" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/bootstrap.min.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/font-awesome/css/font-awesome.min.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/bootstrap-growl.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/style.css" /><link
type="text/css" rel="stylesheet" href="http://my.teamobi.com/beta/app/view/source/css/emoji.css" /><link
rel="stylesheet" href="http://mervick.github.io/lib/emojione/assets/sprites/emojione.sprites.css" /><link
rel="stylesheet" type="text/css" href="http://mervick.github.io//lib/emojionearea/2.1.3/css/emojionearea.css" media="screen"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/google-code-prettify/prettify.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/emojione/lib/js/emojione.min.js"></script> <script type="text/javascript" src="http://mervick.github.io/lib/emojionearea/2.1.3/js/emojionearea.js"></script> </head><body>
<audio
id="chatAudio">
<source
src="http://my.teamobi.com/beta/notify.mp3" type="audio/mpeg"></audio><div
class="container-semifluid"><div
class="container" ><div
class="box_welcome_team pull-right" ></div>
<a
class="pull-left" style="margin: 8px 3px 0px 0px;" href="/home?act">
<img
src="http://my.teamobi.com/app/view/images/logo.png" height=30px /></a></div><div
class=body><div
class="container"><div
class="bg-content"><div
id="box_login_ads"><div
align="center" style="padding-bottom:5px;"></div></div><ol
class="breadcrumb"><li><a
href="/">MXH TeaMobi</a></li><li><a
href="/group/group-message">Phòng chat</a></li><li
class="active">{{get_data('groupchat')[0].data|json_decode['data'~uri[2]].title|default("Tạo phòng chat mới")}}</li></ol>


{%if uri[1]=="new-group-message" %}

{%if k.get('groups_'~sign)|split("@")|length-1>3 %}Tối đa 3 phòng chat {%else%}
{%set tt=get_data('groupchat')[0].data|json_decode%}

{%if get_post("name")!="" and get_post("message")!="" and get_post("sendmessage")!=""%}





{%set tiem={"nick":k.login()|trim,"user":k.login()|trim,"title":get_post("name"),"nd":get_post("message"),"time":"now"|date('U'),"act":"yes","action":"yes","rand":random(100),"uid":(tt['dem']|trim+1),"nickadd":get_post("user_arr")}%}


{{m.up('groups_'~k.login()|trim,tt['dem']|trim+1,'up')}}
{{k.add('groupchat','data'~(tt['dem']|trim+1),tiem)}}
{{k.add('groupchat','dem',tt['dem']|trim+1)}}
<script>document.location="/group"</script>
{%endif%}

<div style="padding-left:10px">
<form
method="POST"><div
class="form-group">
<label
for="exampleInputname">Tên phòng chat</label><p
class="help-block"><small>(Tối đa 100 ký tự)</small></p>
<input
type="text" name="name" class="form-control" id="exampleInputname" value="" maxlength="100" placeholder="Tên phòng chat"></div><div
class="form-group">
<label
for="exampleInputuser">Danh sách thành viên</label><p
class="help-block"><small>(Nhập dạng User1, User2, User3)</small></p>
<input
type="text" name="user_arr" class="form-control" id="exampleInputuser" value="" placeholder="Danh sách thành viên"></div>


<p><div
class="input-group"><textarea name="message" class="form-control" id="contentArea"></textarea><span
class="input-group-addon" id="popover-with-html">
</span></div></p><p
style="text-align:center;"><button
name="sendmessage" type="submit" value="submit" class="btn btn-success" style="width:100%;">Gửi</button></p></form>
</div>

{%endif%}




{#rời phòng#}

{%elseif get_get("do")=="exit" and get_get("uid") and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign in get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nickadd|split(",")%}
{%set er=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}
{{m.del('groups_'~sign,get_get("uid"),'up')}}

{{k.add('groupchat','data'~get_get("uid"),{"nick":er.nick,"user":er.user,"act":er.act,"action":er.action,"time":er.time,"nickadd":er.nickadd|replace({(sign)~',':""}),"title":er.title,"nd":er.nd,"rand":er.rand,"uid":er.uid})}}

<script>document.location="/group/group-message/{{get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid}}"</script>


{#del phòng#}

{%elseif get_get("do")=="out-group" and get_get("uid") and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign==get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nick%}

{%set z=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}
{%for dell in k.get('page_'~get_get("uid"))|split("@")%}
{%if loop.last==false%}
{{k.delarray('bold','data'~dell|trim)}}{%endif%}
{%endfor%}

{%set ck=get_data('bold')[0].data|json_decode['data'~get_get("uid")]%}

{{k.delarray('groupchat','data'~get_get("uid"))}}

{{m.del('groups_'~k.login()|trim,get_get("uid"),'up')}}
{{m.del('page_'~get_get("uid"))}}
{{m.del('groups_'~sign,get_get("uid"),'up')}}

{%for ta in z.nickadd|split(",")%}
{%if loop.last==false%}
{{m.del('groups_'~ta|trim,get_get("uid"),'up')}}
{%endif%}
{%endfor%}






<script>document.location="/group/group-message/{{get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid}}"</script>


{#kick tv#}
{%elseif get_get("do")=="kickgroup" and get_get("uid") and k.get('id_'~get_get("id")) and get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].uid and sign==get_data('groupchat')[0].data|json_decode['data'~get_get("uid")].nick%}
{%set kik=get_data('groupchat')[0].data|json_decode['data'~get_get("uid")]%}

{{m.del('groups_'~k.get('id_'~get_get("id")),get_get("uid"),'up')}}

{{k.add('groupchat','data'~get_get("uid"),{"nick":kik.nick,"name":kik.name,"user":kik.user,"time":kik.time,"action":kik.action,"act":kik.act,"nd":kik.nd,"title":kik.title,"rand":kik.rand,"uid":kik.uid,"nickadd":kik.nickadd|replace({(k.get('id_'~get_get("id")))~',':""})})}}



{#chat phòng#}

{%elseif uri.1=="group-message" and uri.2 and get_data('groupchat')[0].data|json_decode['data'~uri[2]].uid and k.login()|trim==get_data('groupchat')[0].data|json_decode['data'~uri[2]].nick or uri.1=="group-message" and uri.2 and get_data('groupchat')[0].data|json_decode['data'~uri[2]].uid and k.login()|trim in get_data('groupchat')[0].data|json_decode['data'~uri[2]].nickadd|split(",") or uri.1=="group-message" and uri.2 and k.get('user_'~sign,'level')=="admin"%}{%set vv=get_data('groupchat')[0].data|json_decode['data'~uri[2]]%}

{%if get_post("adduser")!="" and get_data_count('user_'~get_post("adduser"))>0 and sign==vv.nick%}
{%if get_post("adduser") in vv.nickadd|split(',')%}
<br>Thêm thành viên {{get_post("adduser")}} thất bại<br>
{%else%}
{{m.up('groups_'~get_post("adduser"),uri[2],'up')}}

{{m.up('tb_open_'~get_post("adduser"),'group-'~get_post("adduser")~'-'~sign~'-'~uri[2]~'-'~"now"|date('U'),'up')}}
<br>thêm thành viên {{get_post("adduser")}} thành công<br>
{{k.add('groupchat','data'~uri[2],{"nick":vv.nick,"user":vv.user,"time":vv.time,"act":vv.act,"action":vv.action,"title":vv.title,"nd":vv.nd,"rand":vv.rand,"uid":vv.uid,"nickadd":vv.nickadd~get_post("adduser")~','})}}
<script>document.location="/group"</script>


{%endif%}

{%endif%}

{%if get_post("reply")!="" %}<script>document.location=""</script>
{%set f=get_data('bold')[0].data|json_decode%}
{{m.up('page_'~vv.uid,(f['dem']|trim+1),'up')}}
{{k.add('bold','data'~(f['dem']|trim+1),{"nick":sign,"name":sign,"title":get_post("reply"),"action":"yes","time":"now"|date('U'),"uid":(f['dem']|trim+1)})}}
{{k.add('bold','dem',f['dem']|trim+1)}}
{{m.up('groupall',(f['dem']|trim+1),'up')}}

{%endif%}

<div>
<form method="post">
<p><div
class="input-group"><textarea name="reply" class="form-control" id="contentArea"></textarea><span
class="input-group-addon" id="showsmile" data-toggle="collapse" data-target="#emoticons">
<span
class="fa fa-smile-o"></span>
</span></div></p><p
style="text-align:center;"><button
name="sendmessage" class="btn btn-success" style="width:100%;"><span
class="glyphicon glyphicon-send"></span></button></p></form><p><span
class="btn btn-default btn-xs" data-toggle="collapse" data-target="#listtv" onclick="myFunction()">
Danh sách thành viên
</span> {%if sign==vv.nick%}<a
onclick="return confirm('Giải tán phòng? Sẽ xóa tất cả tin nhắn trong phòng chat')" href="/group?do=out-group&uid={{vv.uid}}" class="btn btn-danger btn-xs">Giải tán phòng</a>{%elseif sign in vv.nickadd|split(",")%}<a
onclick="return confirm('Bạn chắc chắn muốn thoát phòng?')" href="/group?do=exit&uid={{vv.uid}}" class="btn btn-danger btn-xs">Thoát khỏi phòng</a>{%endif%}</p><div style="display:none" id="panel"
class="alert alert-info"><small>
Chủ phòng: <a><b>{{k.get('user_'~vv.nick,'nick')}}</b></a> - Thành viên: {%for r in vv.nickadd|split(",")%}{%if loop.last==false%}
<a>{{k.get('user_'~r|trim,'nick')}}</a> <a
href="/group/?do=kickgroup&uid={{vv.uid}}&id={{k.get('user_'~r|trim,'id')}}" onclick="return confirm('Bạn có muốn kick thành viên này?')"><span
style="font-size: 9px;">x</span></a>,{%endif%}{%endfor%}
</small>{%if sign==vv.nick%}<div><form
method="post" class="form-inline">
<input
type="text" class="form-control" name="adduser" placeholder="Thêm thành viên"> <button
class="btn btn-default" type="submit">Thêm</button>
</form></div>{%endif%}</div></div>


<ul
class="list-group" id="listgroup">

{%for t in k.get('page_'~vv.uid)|split("@")%}
{%set tv=get_data('bold')[0].data|json_decode['data'~t|trim]%}{%if loop.last==false%}
{#%if vv.uid in t|trim%#}
<li
class="list-group-item" id="{{tv.uid}}">
<span
class="pull-right"><a
href="/user?for=user&do=detail&uid={{k.get('user_'~tv.nick,'id')}}">
<img
class="thumbnail" height="30px" src="{{k.get('user_'~tv.nick,'icon')}}"/>
</a></span><h5 class="list-group-item-heading box_oxx_{{k.get('user_'~tv.nick,'level')}}">
<!--img
style="vertical-align:middle;" src="/images/online.png" border="0" /-->
<a
href="/user?for=user&do=detail&uid={{k.get('user_'~tv.nick,'id')}}">{{k.get('user_'~tv.nick,'nick')}}</a>
<small><i><span
class="timeago">{{ago(tv.time)}}</span>
</i></small></h5><p
class="list-group-item-text">{{tv.title|striptags}}</p></li>
{#%endif%#}{%endif%}
{%endfor%}
</ul>

{#danh sách phòng chat#}


{%else%}


<p><a
class="btn btn-info" href="/group/new-group-message" >Tạo phòng</a></p>
<div><ul
class="pagination"></ul></div>
{%for i in k.get('groups_'~get_get("act")|default(k.login()|trim))|split("@")%}{%set nchat=get_data('groupchat')[0].data|json_decode['data'~i|trim]%}{%if loop.last==false%}

{%for entry in nchat.nickadd|split(',')%}{%if loop.last==false and entry != nchat.nick and get_data_count('user_'~entry|trim)>0%}
{{m.up('tb_open_'~entry|trim,'group-'~entry|trim~'-'~sign~'-'~i|trim~'-'~"now"|date('U'),'up')}}{%endif%}

{%endfor%}

<div
class="list-group">
<small>
<a
href="/group/group-message/{{nchat.uid}}" class="list-group-item "><h4 class="list-group-item-heading box_">
{{nchat.title|striptags}} - {{k.get('user_'~nchat.nick,'nick')}}</h4><p
class="list-group-item-text"><img
src="http://my.teamobi.com/beta/app/images/reply.png" /> {{nchat.nd|striptags}}</p><p
class="alert alert-info"><small><b>Thành viên:</b>
{%for v in nchat.nickadd|split(",")%}
{{k.get('user_'~v|trim,'nick')}}{%if loop.last==false%},{%endif%}{%endfor%}</small></p>
<small><i><span
class="timeago">{{ago(nchat.time)}}</span></i></small>
</a></small></div>
{%endif%}
{%endfor%}
{%endif%}
<div><ul
class="pagination"></ul></div></div></div></div><div
class="navbar-fixed-bottom scrollup" style="margin:10px;width: 30px;">
<a
href="#" style="font-size: 30px;"><i
class="glyphicon glyphicon-upload"></i></a></div><div
class="blog-footer"><div
class="row"><div
align="center">
TeaMobi @2014<center><br></center>

<script>
function myFunction() {
document.getElementById("panel").style.display = "block";
}
</script>
</div></div></div> </body></html></body></html>
{%endif%}
[/php]
* MrDucz2k  (Member) [Off]
56 * 109
*   Cách đây 1 tháng
Chiểu giờ trùm cmnr
* Lvy2003  (Member) [Off]
18 * 12
*   Cách đây 1 tháng
Gửi từ nhokdung:
Chào ae code phòng chat thêm thành viên vài như một chức năng hội nhóm [b]chức năng[/b] Tạo phòng chat Kick thành viên Thêm thành viên Rời nhóm Giải tán phòng xóa tất cả liên quan đến ...
Trùm wap teamobi cmnr
▼ Tổng số: 7
- Share:
BBCode:

Link: