aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Wiki_pages.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-15 21:26:28 -0700
committerMario Vavti <mario@mariovavti.com>2017-03-29 11:57:00 +0200
commit0908da95298bdd7dd96dcb45ac490f8e7aa73a8e (patch)
treeb38469f6a9b0fe3b59aba02a32eed813ba1df7b9 /Zotlabs/Widget/Wiki_pages.php
parent6e101e458268c0f9b7bf461cea3c31c37b5e3791 (diff)
downloadvolse-hubzilla-0908da95298bdd7dd96dcb45ac490f8e7aa73a8e.tar.gz
volse-hubzilla-0908da95298bdd7dd96dcb45ac490f8e7aa73a8e.tar.bz2
volse-hubzilla-0908da95298bdd7dd96dcb45ac490f8e7aa73a8e.zip
widgets cont.
Diffstat (limited to 'Zotlabs/Widget/Wiki_pages.php')
-rw-r--r--Zotlabs/Widget/Wiki_pages.php59
1 files changed, 59 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Wiki_pages.php b/Zotlabs/Widget/Wiki_pages.php
new file mode 100644
index 000000000..bad451475
--- /dev/null
+++ b/Zotlabs/Widget/Wiki_pages.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+
+class Wiki_pages {
+
+ function widget($arr) {
+
+ $channelname = ((array_key_exists('channel',$arr)) ? $arr['channel'] : '');
+ $c = channelx_by_nick($channelname);
+
+ $wikiname = '';
+ if(array_key_exists('refresh', $arr)) {
+ $not_refresh = (($arr['refresh']=== true) ? false : true);
+ }
+ else {
+ $not_refresh = true;
+ }
+
+ $pages = array();
+ if(! array_key_exists('resource_id', $arr)) {
+ $hide = true;
+ }
+ else {
+ $p = \Zotlabs\Lib\NativeWikiPage::page_list($c['channel_id'],get_observer_hash(),$arr['resource_id']);
+
+ if($p['pages']) {
+ $pages = $p['pages'];
+ $w = $p['wiki'];
+ // Wiki item record is $w['wiki']
+ $wikiname = $w['urlName'];
+ if (!$wikiname) {
+ $wikiname = '';
+ }
+ }
+ }
+
+ $can_create = perm_is_allowed(\App::$profile['uid'],get_observer_hash(),'write_wiki');
+
+ $can_delete = ((local_channel() && (local_channel() == \App::$profile['uid'])) ? true : false);
+
+ return replace_macros(get_markup_template('wiki_page_list.tpl'), array(
+ '$hide' => $hide,
+ '$resource_id' => $arr['resource_id'],
+ '$not_refresh' => $not_refresh,
+ '$header' => t('Wiki Pages'),
+ '$channel' => $channelname,
+ '$wikiname' => $wikiname,
+ '$pages' => $pages,
+ '$canadd' => $can_create,
+ '$candel' => $can_delete,
+ '$addnew' => t('Add new page'),
+ '$pageName' => array('pageName', t('Page name')),
+ ));
+ }
+}
+
+