communitydetails.blade.php
17.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
<?php
use App\Models\User;
use App\Models\Educourse;
use App\Jobs\KFriendLib;
function aclCommSelect($allcircles,$my_friends,$aclothrlist,$post_type)
{
$aclselect= "<select multiple='multiple' id='acl$post_type' name='acl$post_type"."[]' class='select2multi col-md-9'>";
$aclselect.= "<option value='Friends'>Friends</option>";
$aclselect.= "<option value='Followers'>Followers</option>";
if(isset($allcircles) && is_array($allcircles))
{
$aclselect.= "<optgroup label='Circles'>";
foreach($allcircles as $eachcircle)
{
$aclselect.= "<option value='g_$eachcircle'>$eachcircle</option>";
}
$aclselect.= "</optgroup>";
}
if(isset($my_friends) && is_array($my_friends))
{
$aclselect.= "<optgroup label='Friends'>";
foreach($my_friends as $key=>$eachfriend)
$aclselect.= "<option value='f_$key'>$eachfriend</option>";
$aclselect.= "</optgroup>";
}
if(isset($aclothrlist) && is_array($aclothrlist))
{
$aclselect.= "<optgroup label='Followers'>";
foreach($aclothrlist as $key=>$val)
{$aclselect.= "<option value='f_$key'>$val</option>";}
$aclselect.= "</optgroup>";
}
$allusers=User::all();
$aclselect.="<optgroup label='All Users'>";
foreach($allusers as $tuser)$aclselect.="<option value='f_".$tuser->id."'>".explode("@",$tuser->username)[0]."</option>";
$aclselect.="</optgroup>";
$aclselect.="</select>";
return $aclselect;
}
?>
@if(isset($create)=="y")
<div class="col-separator box col-unscrollable">
<!-- Heading -->
<h5 class="innerAll margin-none bg-primary">
<i class="fa fa-fw fa-pencil"></i> Create New Community
<a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="return false">
<i class="fa fa-globe fa-fw"></i>
</a>
</h5>
<div class="clearfix"></div>
<form class="innerAll">
<fieldset>
<div class="control-group">
<label class="col-md-4 control-label">Community Name</label>
<div class="col-md-8 controls">
<input class="form-control" type="text" id="comm_name" name="comm_name" placeholder="Choose a Name for Your Community" />
</div>
</div>
<div class="clearfix"></div>
<div class="control-group">
<label class="col-md-4 control-label">Business Function</label>
<div class="col-md-8 controls">
<input type=text id="createcommunitycategory" class='form-control' style='min-width:50%'>
<!-- <option></option> -->
<?php
//$carr=Educourse::distinct('category')->get(array('category'));
//foreach($carr as $cval)if(!strstr($cval->category,",")&&trim($cval->category)!="")echo "<option value='".$cval->category."'>".$cval->category."</option>";
?>
<!-- </select> -->
</div>
</div><div class="clearfix"></div>
<div class="control-group">
<label class="col-md-4 control-label">Community Description(max. 5000 characters)</label>
<div class="col-md-8 controls">
<textarea class="wysihtml5 form-control" rows="5" id="comm_desc" placeholder="Write a short description of this community"></textarea>
</div>
</div><div class="clearfix"></div>
<div class="control-group">
<label class="col-md-4 control-label">Add People to Your Community</label>
<div class="col-md-8 controls">
<select placeholder="--- You Can Select Multiple options" multiple="multiple" style="width:100%" id="invitee" class="select2multi">
@if(isset($allcircles) && is_array($allcircles))
<optgroup label="My Circles">
@foreach($allcircles as $eachcircle)
<option value="g_{!!$eachcircle!!}">{!!$eachcircle!!}</option>
@endforeach
</optgroup>
@endif
@if(isset($my_friends) && is_array($my_friends))
<optgroup label="My Friends">
@foreach($my_friends as $key=>$eachfriend)
<option value="f_{!!$key!!}">{!!$eachfriend!!}</option>
@endforeach
</optgroup>
@endif
@if(isset($my_followers) && is_array($my_followers))
<optgroup label="My Followers">
@foreach($my_followers as $key=>$eachfollower)
<option value="f_{!!$key!!}">{!!$eachfollower!!}</option>
@endforeach
</optgroup>
@endif
<optgroup label="All Users">
<?php
$allusers=User::all();
?>
@foreach($allusers as $tuser)
<option value="f_{!!$tuser->id!!}">{!!explode("@",$tuser->username)[0]!!}</option>
@endforeach
</optgroup>
</select>
</div>
</div><div class="clearfix"></div>
<div class="control-group">
<label class="col-md-4 control-label">Set Visibility</label>
<div class="col-md-8 controls">
<select style="width:25%;" id="type" class="select2multi">
<option value="OnlyMe">OnlyMe</option>
<option value="Friends">Only Friends</option>
<option value="Followers">Friends & Followers</option>
<option selected="selected" value="Public">Public</option>
</select>
</div>
</div><div class="clearfix"></div>
</fieldset>
</form>
<div class="clearfix"></div>
<br><hr><br>
<div class="innerAll">
<a class="btn btn-success" onclick="submit_community();return false;">Create Community <i class="fa fa-globe"></i></a>
</div>
</div>
@endif
@if(isset($show)=="y" && isset($show_community))
<?php if(Input::get('target')=='content'){ ?>
<div class="layout-app"><!-- row-app -->
<div class="row row-app">
<div class="col-md-12">
<div class="col-separator col-separator-first col-unscrollable box">
<div class="">
<?php } ?>
<div class="col-separator box col-unscrollable" id=communitydetailstop>
<!-- Heading -->
<h5 class="innerAll margin-none bg-primary">
<i class="fa fa-fw fa-pencil"></i> {!!$show_community->name!!}
<?php if($show_community->owner==Auth::user()->id){ ?>
<a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;margin-left:5px" onclick="delete_community('{!!$show_community->id!!}');return false;">
Delete Community <i class="fa fa-globe fa-fw"></i></a>
<?php }else if(!isset($communityjoined)) { ?>
<a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="join_community('{!!$show_community->id!!}');return false;">
Join Community <i class="fa fa-globe fa-fw"></i></a>
<?php }else { ?>
<a href="#" class="btn btn-sm btn-inverse pull-right btn-xs" style="margin-top: -5px;" onclick="leave_community('{!!$show_community->id!!}');return false;">
Leave Community <i class="fa fa-globe fa-fw"></i></a>
<?php } ?>
</h5>
<div class="clearfix"></div>
<div class="widget widget-tabs widget-tabs-social-account widget-tabs-responsive">
<div class="widget-body">
<div class="tab-content">
<div id="tabAccount" class="tab-pane active widget-body-regular padding-none border-none reset-components">
<div class="widget widget-tabs border-bottom-none">
<div class="widget-head">
<ul>
<li class="active"><a onclick="libshow_community_wall('{!!$show_community->id!!}','activity');" class="glyphicons comments" href="#community-posts" data-toggle="tab"><i></i>All Posts</a></li>
<li class=""><a onclick="libshow_community_wall('{!!$show_community->id!!}','attachment');" class="glyphicons file" href="#community-files" data-toggle="tab"><i></i>Knowledge Bank</a></li>
<li><a class="glyphicons edit" href="#community-desc" data-toggle="tab"><i></i>Community Description</a></li>
</ul>
</div>
<div class="widget-body">
<!-- Dropzone -->
<!-- <div id="dropzone">
<form action="" class="dropzone kstych_init" id=communitylogoupload>
<div class="fallback">
<input name="file" type="file" />
</div>
</form>
</div>
<script>
var authorfileDropzone = new Dropzone("#communitylogoupload", { url: "fileupload?communitylogoupload=1"});
authorfileDropzone.on("complete", function(file) {
authorfileDropzone.removeFile(file);
//$("#communitylogoupload").hide();
simpleNotification('success','topRight','File Saved');
});
</script>-->
<div class="tab-content">
<div class="tab-pane active" id="community-posts">
<div class="col-app col-unscrollable">
<div class="col-app box" id=wallsdivp>
<div class="innerAll">
<?php
unset($allcommunities);unset($allcircles);unset($my_friends);unset($aclothrlist);
$allcommunities['my_communities'][]=$show_community;$nodefault=1;$postreloadfunction="libshow_community_wall('".$show_community->id."','activity');";
if($show_community->owner==Auth::user()->id)$context="community__".substr($show_community->name,0,45)."__".$show_community->id;
?>
<div id="postin_area_top" style='display:none'>
@include('layout.module.social.indexareapost')
</div>
<div class="innerLR heading-buttons border-bottom" id=wallsdivppp>
<h4 class="margin-none pull-left">Recent Activity</h4>
<div class="pull-left" style='margin:7px;margin-left:5px;width:20%'>
<input type=hidden id=activityfilterhashtags class="form-control text-primary" style='height:26px;padding:2px;' placeholder='filter by #tags and refresh'>
<input type=hidden id='activitywall_filter' value='c_{!!$show_community->id!!}'>
</div>
<div class="btn-group btn-group-xs pull-right">
<?php //if($show_community->owner==Auth::user()->id){ ?>
<button onclick="expandWall(); return false;" id="expand_wall" class="btn btn-default"><i id="expand_wall_icon" class="fa fa-th "></i><span id="expand_wall_txt" style="margin:3px;">Write Post</span></button>
<?php //} ?>
</div>
<div class="clearfix"></div>
</div>
<div class="col-app col-unscrollable">
<div class="col-app">
<input type=hidden id=activitylastdate value=''>
<ul class="timeline-activity list-unstyled" id=activitywallul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane active" id="community-files">
<div class="col-app col-unscrollable">
<div class="col-app box" id=attachmentwallsdivp>
<div class="innerAll">
<?php
if($show_community->owner==Auth::user()->id){
unset($allcommunities);unset($allcircles);unset($my_friends);unset($aclothrlist);
$allcommunities['my_communities'][]=$show_community;$nodefault=1;$context="community__".substr($show_community->name,0,45)."__".$show_community->id;$postreloadfunction="libshow_community_wall('".$show_community->id."','attachment');";
?>
<?php } ?>
<div class="innerLR heading-buttons border-bottom" id=attachmentwallsdivppp>
<div class="pull-left" style='margin:7px;margin-left:5px;width:20%'>
<input type=hidden id=attachmentfilterhashtags class="form-control text-primary" style='height:26px;padding:2px;' placeholder='filter by #tags and refresh'>
<input type=hidden id='attachmentwall_filter' value='c_{!!$show_community->id!!}'>
</div>
<div class="btn-group btn-group-xs pull-right">
</div>
<div class="clearfix"></div>
</div>
<div class="col-app col-unscrollable">
<div class="col-app">
<input type=hidden id=attachmentlastdate value=''>
<ul class="timeline-activity list-unstyled" id=attachmentwallul>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane" id="community-desc">
<div class="col-app col-unscrollable">
<div class="col-app">
<div class="innerAll col-md-6">
<?php if($show_community->owner==Auth::user()->id){
$aclothrlist=array();
$frnd=new KFriendLib();
$my_friends=$frnd->myFrndNMList(Auth::user()->id);
$allcircles=$frnd->myCircleList(Auth::user()->id);
$my_followers=$frnd->myFolrList(Auth::user()->id);
foreach($my_followers as $each_follower)
{
$follower=User::find($each_follower);
$aclothrlist[$follower->id]=$follower->dispname();
}
?>
<h4 class="innerAll border-bottom margin-none">Add Users</h4>
{!!aclCommSelect($allcircles,$my_friends,$aclothrlist,"comm_acl_add")!!}
<a class="btn btn-success" onclick="submit_add_community('{!!$show_community->id!!}');return false;">Add <i class="fa fa-globe"></i></a>
<div class="clearfix"></div>
<?php } ?>
<h4 class="innerAll border-bottom margin-none">About Community</h4>
<span>{!!$show_community->description!!}</span>
</div>
<div class="col-md-6">
<h4 class="innerAll border-bottom margin-none">Users in Community ({!!sizeof($followusers)!!})</h4>
<div data-toggle="gridalicious" data-gridalicious-width="280" data-gridalicious-gutter="0">
<!-- <ul class="list-group list-group-1 borders-none margin-none"> -->
@if(isset($followusers))
@foreach($followusers as $eachfollower)
<!-- <li class="list-group-item active pull-left" style='margin:4px;height:65px;width:190px;overflow-y:hidden'>
<div class="media innerAll">
<div class=pull-right>-->
<!-- <button class="btn btn-primary btn-stroke btn-xs" onclick='return false;' title='click to remove'><i class="fa fa-times"></i></button><br> -->
<!-- <button class="btn btn-primary btn-stroke btn-xs" onclick='show_user_details({!!$eachfollower->id!!},this);return false;' title='click to add new'><i class="fa fa-edit"></i></button>
</div>
<img src="{!!$eachfollower->fetchphotothumb()!!}" alt="" width="50" height=50 class="pull-left thumb">
<div class="media-body">
<h5 class="media-heading strong">{!!$eachfollower->dispname()!!} </h5>
<ul class="list-unstyled text-faded">-->
<!-- <li><i class="fa fa-plus"></i> {!!$eachfollower->usertype!!} </li> -->
<!-- <li><i class="fa fa-book"></i> </li> -->
<!-- </ul>
</div>
</div>
</li>-->
<a data-toggle="image-preview" data-title="{!!$eachfollower->dispname()!!}" data-content="<small></small>" data-image-preview="{!!$eachfollower->fetchphotothumb()!!}" width="100" href="#" class="innerAll half pull-left border-none" onclick='show_user_details({!!$eachfollower->id!!},this);return false;'>
<img src="{!!$eachfollower->fetchphotothumb()!!}" alt="photo" width="35">
</a>
@endforeach
@endif
<!-- </ul> -->
<div class="clearfix"></div>
</div>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if(Input::get('target')=='content'){ ?>
</div>
</div>
</div>
</div>
</div><!-- // END row-app -->
<?php } ?>
@endif
<script type="text/javascript">
$(document).ready(function(){
@if(isset($show)=="y" && isset($show_community))
libshow_community_wall('{!!$show_community->id!!}','activity');
@endif
});
lastwallfeed='activity';
function submit_community()
{
var varstr='stype=submit_community&name='+$("#comm_name").val()+'&desc='+encodeURIComponent($("#comm_desc").val())+'&invitee='+$("#invitee").val()+'&type='+$("#type").val()+"&category="+$("#createcommunitycategory").val();
doAjax('social?'+varstr,'','','ajax_profile_update','singlefail','POST',function(){
doAjax('social?stype=create_community','','searched_friends','ajax_profile_update','singlefail','POST');
});
}
function libshow_community_wall(e,type)
{
lastwallfeed=type;
$("#filecaption").val("");
doAjax('social/{!!Auth::user()->id!!}?show=wall&wall='+type+'&filter=c_'+e,'',type+'wallul','ajax_wall_show','singlefail','GET');
// var varstr='stype=libshow_community_wall&comm='+e;
// doAjax('social?'+varstr,'','community_wall','ajax_profile_update','singlefail','POST');
}
function join_community(e)
{
var varstr='stype=join_community&comm='+e;
doAjax('social?'+varstr,'','','ajax_profile_update','singlefail','POST',function(){
doAjax('social?stype=load_communitydetails&show_community='+e,'','searched_friends','ajax_profile_update','singlefail','POST');
});
}
function leave_community(e)
{
var varstr='stype=leave_community&comm='+e;
doAjax('social?'+varstr,'','','ajax_profile_update','singlefail','POST',function(){
doAjax('social?stype=load_communitydetails&show_community='+e,'','searched_friends','ajax_profile_update','singlefail','POST');
});
}
function delete_community(e)
{
var varstr='stype=delete_community&comm='+e;
doAjax('social?'+varstr,'','','ajax_profile_update','singlefail','POST',function(){
doAjax('social?stype=load_communitydetails&show_community='+e,'','searched_friends','ajax_profile_update','singlefail','POST');
});
}
// $("#community-desc").height($("#communitydetailstop").height()-130);
// $("#activitywallul").height($("#communitydetailstop").height()-180);
$("#activitywallul").parent().bind("scroll",function(){
//console.log(""+$("#activitywallul").parent().scrollTop()+" "+$("#activitywallul").parent().prop('scrollHeight')+" "+$("#activitywallul").parent().height());
var diff=$("#activitywallul").parent().prop('scrollHeight')-$("#activitywallul").parent().scrollTop()-$("#activitywallul").parent().height();
if(diff<100&&$("#activitylastdate").val()!="")
{
var idprepend=$("#activitylastdate").val();
idprepend=idprepend.replace(/-/g,"");
idprepend=idprepend.replace(/:/g,"");
idprepend=idprepend.replace(/ /g,"");
show_wall_feeds("activity",1);
$("#"+idprepend+"activitywalldivul").css({"display":"none"});
}
});
function submit_add_community(e)
{
var varstr='stype=addto_community&comm='+e+'&commacl='+$("#aclcomm_acl_add").val();
doAjax('social?'+varstr,'','','ajax_profile_update','singlefail','POST',function(){
doAjax('social?stype=load_communitydetails&show_community='+e,'','searched_friends','ajax_profile_update','singlefail','POST');
});
}
</script>
@include('layout.module.social.indexareascript')