aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-01-07 20:07:09 +0000
committerMario <mario@mariovavti.com>2022-01-07 20:07:09 +0000
commit7450ac1a31596ba7dade032d6a38008eb339eba2 (patch)
tree334794fbee823c68bbd63031a2389279b9ec1c29 /Zotlabs
parentc72e5e3b66db227e27a400044dcc0a6748d49cb5 (diff)
downloadvolse-hubzilla-7450ac1a31596ba7dade032d6a38008eb339eba2.tar.gz
volse-hubzilla-7450ac1a31596ba7dade032d6a38008eb339eba2.tar.bz2
volse-hubzilla-7450ac1a31596ba7dade032d6a38008eb339eba2.zip
missing files
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Widget/Privacygroups.php55
-rw-r--r--Zotlabs/Widget/Tokens.php51
2 files changed, 106 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Privacygroups.php b/Zotlabs/Widget/Privacygroups.php
new file mode 100644
index 000000000..74ce02ccd
--- /dev/null
+++ b/Zotlabs/Widget/Privacygroups.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+use Zotlabs\Lib\AccessList;
+
+class Privacygroups {
+
+ function widget($arr) {
+
+ $o = '';
+
+ $groups = q("SELECT id, gname FROM pgrp WHERE deleted = 0 AND uid = %d ORDER BY gname ASC",
+ intval(local_channel())
+ );
+
+ if (!$groups) {
+ return $o;
+ }
+
+ $menu_items = [];
+ $z_root = z_root();
+ $active = argv(1) ?? '';
+
+ foreach($groups as $group) {
+ $menu_items[] = [
+ 'href' => $z_root . '/group/' . $group['id'],
+ 'label' => $group['gname'],
+ 'title' => '',
+ 'active' => ($active === $group['id']),
+ 'count' => count(AccessList::members(local_channel(), $group['id']))
+ ];
+ }
+
+ if ($active) {
+ $menu_items[] = [
+ 'href' => $z_root . '/group',
+ 'label' => '<i class="fa fa-plus"></i> &nbsp;' . t('Add new privacy group'),
+ 'title' => '',
+ 'active' => '',
+ 'count' => ''
+ ];
+ }
+
+ $tpl = get_markup_template("widget_menu_count.tpl");
+ $o .= replace_macros($tpl, [
+ '$title' => t('Privacy groups'),
+ '$menu_items' => $menu_items,
+
+ ]);
+
+ return $o;
+
+ }
+}
diff --git a/Zotlabs/Widget/Tokens.php b/Zotlabs/Widget/Tokens.php
new file mode 100644
index 000000000..8c31003fc
--- /dev/null
+++ b/Zotlabs/Widget/Tokens.php
@@ -0,0 +1,51 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Tokens {
+
+ function widget($arr) {
+
+ $o = '';
+
+ $tokens = q("SELECT atoken_id, atoken_name FROM atoken WHERE atoken_uid = %d",
+ intval(local_channel())
+ );
+
+ if (!$tokens) {
+ return $o;
+ }
+
+ $menu_items = [];
+ $z_root = z_root();
+ $active = argv(1) ?? '';
+
+ foreach($tokens as $token) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens/' . $token['atoken_id'],
+ 'label' => $token['atoken_name'],
+ 'title' => '',
+ 'active' => ($active === $token['atoken_id'])
+ ];
+ }
+
+ if ($active) {
+ $menu_items[] = [
+ 'href' => $z_root . '/tokens',
+ 'label' => '<i class="fa fa-plus"></i> &nbsp;' . t('Add new guest'),
+ 'title' => '',
+ 'active' => ''
+ ];
+ }
+
+ $tpl = get_markup_template("widget_menu.tpl");
+ $o .= replace_macros($tpl, [
+ '$title' => t('Guest access'),
+ '$menu_items' => $menu_items,
+
+ ]);
+
+ return $o;
+
+ }
+}