aboutsummaryrefslogtreecommitdiffstats
path: root/include/group.php
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-11-21 12:34:22 +0100
committerFabio Comuni <fabrix.xm@gmail.com>2011-11-21 12:34:22 +0100
commita86fd26bd86945fe75b7220e149b8986f88feb01 (patch)
tree75d3f73e9bcb4fc990bc35b0781d479f40ac9cfb /include/group.php
parent590f1d2b25c00fc7bea85cb5de1a4f667ea86af1 (diff)
downloadvolse-hubzilla-a86fd26bd86945fe75b7220e149b8986f88feb01.tar.gz
volse-hubzilla-a86fd26bd86945fe75b7220e149b8986f88feb01.tar.bz2
volse-hubzilla-a86fd26bd86945fe75b7220e149b8986f88feb01.zip
more work on quattro. remove html from php for groups and saved searches widgets.
Diffstat (limited to 'include/group.php')
-rw-r--r--include/group.php66
1 files changed, 38 insertions, 28 deletions
diff --git a/include/group.php b/include/group.php
index 084cddcac..cae76eb6d 100644
--- a/include/group.php
+++ b/include/group.php
@@ -162,23 +162,20 @@ function group_side($every="contacts",$each="group",$edit = false, $group_id = 0
if(! local_user())
return '';
- $createtext = t('Create a new group');
- $linktext= t('Everybody');
- $selected = (($group_id == 0) ? ' group-selected' : '');
-$o .= <<< EOT
-
-<div id="group-sidebar" class="widget">
-<h3>Groups</h3>
+ $groups = array();
+
+ $groups[] = array(
+ 'text' => t('Everybody'),
+ 'selected' => (($group_id == 0) ? 'group-selected' : ''),
+ 'href' => $every,
+ );
-<div id="sidebar-group-list">
- <ul id="sidebar-group-ul">
- <li class="sidebar-group-li" ><a href="$every" class="sidebar-group-element$selected" >$linktext</a></li>
-EOT;
$r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval($_SESSION['uid'])
);
+ $member_of = array();
if($cid) {
$member_of = groups_containing(local_user(),$cid);
}
@@ -186,25 +183,38 @@ EOT;
if(count($r)) {
foreach($r as $rr) {
$selected = (($group_id == $rr['id']) ? ' group-selected' : '');
- $o .= ' <li class="sidebar-group-li">'
- . (($edit) ? "<a href=\"group/{$rr['id']}\" title=\"" . t('Edit')
- . "\" class=\"groupsideedit\" ><span class=\"icon small-pencil\"></span></a> " : "")
- . (($cid) ? '<input type="checkbox" class="' . (($selected) ? 'ticked' : 'unticked') . '" onclick="contactgroupChangeMember(' . $rr['id'] . ',' . $cid . ');return true;" '
- . ((in_array($rr['id'],$member_of)) ? ' checked="checked" ' : '') . '/>' : '')
- . "<a href=\"$each/{$rr['id']}\" class=\"sidebar-group-element" . $selected ."\" >{$rr['name']}</a></li>\r\n";
+
+ if ($edit) {
+ $groupedit = array(
+ 'href' => "group/".$rr['id'],
+ 'title' => t('edit'),
+ );
+ } else {
+ $groupedit = null;
+ }
+
+ $groups[] = array(
+ 'id' => $rr['id'],
+ 'cid' => $cid,
+ 'text' => $rr['name'],
+ 'selected' => $selected,
+ 'href' => $each."/".$rr['id'],
+ 'edit' => $groupedit,
+ 'ismember' => in_array($rr['id'],$member_of),
+ );
}
}
- $o .= " </ul>\r\n </div>";
-
- $o .= <<< EOT
-
- <div id="sidebar-new-group">
- <a href="group/new">$createtext</a>
- </div>
-</div>
-EOT;
-
+
+ $tpl = get_markup_template("group_side.tpl");
+ $o = replace_macros($tpl, array(
+ '$title' => t('Groups'),
+ '$createtext' => t('Create a new group'),
+ '$groups' => $groups,
+ '$add' => t('add'),
+ ));
+
+
return $o;
}
@@ -246,4 +256,4 @@ function groups_containing($uid,$c) {
}
return $ret;
-} \ No newline at end of file
+}