Elgg  Version 2.3
collection.php
Go to the documentation of this file.
1 <?php
11 $coll = $vars['collection'];
12 
13 if (is_array($vars['collection']->members)) {
14  $count = sizeof($vars['collection']->members);
15 } else {
16  $count = 0;
17 }
18 
19 echo "<li><h2>";
20 
21 //as collections are private, check that the logged in user is the owner
22 if ($coll->owner_guid == elgg_get_logged_in_user_guid()) {
23  echo "<div class=\"friends_collections_controls\">";
24  echo elgg_view('output/url', array(
25  'href' => 'action/friends/collections/delete?collection=' . $coll->id,
26  'class' => 'delete_collection',
27  'text' => elgg_view_icon('delete'),
28  'encode_text' => false,
29  'confirm' => true,
30  ));
31  echo "</div>";
32 }
33 echo $coll->name;
34 echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>";
35 
36 // individual collection panels
37 $friends = $vars['collection']->entities;
38 if ($friends) {
39  $content = elgg_view('core/friends/collectiontabs', array(
40  'owner' => elgg_get_logged_in_user_entity(),
41  'collection' => $vars['collection'],
42  'friendspicker' => $vars['friendspicker'],
43  ));
44 
45  echo elgg_view('input/friendspicker', array(
46  'entities' => $friends,
47  'value' => $vars['collection']->members,
48  'content' => $content,
49  'replacement' => '',
50  'friendspicker' => $vars['friendspicker'],
51  ));
52 ?>
53  <script>
54  require(['elgg', 'jquery'], function(elgg, $) {
55  $(function () {
56  var url = elgg.config.wwwroot + 'collections/pickercallback' +
57  '?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>' +
58  '&type=list&collection=<?php echo $vars['collection']->id; ?>';
59  $('#friends-picker_placeholder<?php echo $vars['friendspicker']; ?>').load(url);
60  });
61  });
62  </script>
63  <?php
64 }
65 
66 // close friends-picker div and the accordian list item
67 echo "</li>";
elgg
Definition: install.js:23
elgg_view_icon($name, $vars=array())
View one of the icons.
Definition: views.php:1582
$friends
Definition: collection.php:37
$vars['entity']
$coll
Definition: collection.php:11
elgg echo
Translates a string.
Definition: languages.js:48
elgg require
Throw an error if the required package isn&#39;t present.
Definition: elgglib.js:164
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
$content
Set robots.txt action.
Definition: set_robots.php:6
if(!$site) if(!($site instanceof ElggSite)) $site url
if(elgg_in_context('widget')) $count
Definition: pagination.php:21
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42