diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-15 19:30:57 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-29 11:49:32 +0200 |
commit | 47f4007951ce3311ee267a863a2cc46085c4892a (patch) | |
tree | 4bb26968cfac76fdc76997683e01cc4d19e466c7 /Zotlabs/Widget/Archive.php | |
parent | 74f58818d628a30297f48720b73c094b215f593b (diff) | |
download | volse-hubzilla-47f4007951ce3311ee267a863a2cc46085c4892a.tar.gz volse-hubzilla-47f4007951ce3311ee267a863a2cc46085c4892a.tar.bz2 volse-hubzilla-47f4007951ce3311ee267a863a2cc46085c4892a.zip |
more widgets
Diffstat (limited to 'Zotlabs/Widget/Archive.php')
-rw-r--r-- | Zotlabs/Widget/Archive.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Archive.php b/Zotlabs/Widget/Archive.php new file mode 100644 index 000000000..c151ca563 --- /dev/null +++ b/Zotlabs/Widget/Archive.php @@ -0,0 +1,55 @@ +<?php + +namespace Zotlabs\Widget; + + +class Archive { + + function widget($arr) { + + $o = ''; + + if(! \App::$profile_uid) { + return ''; + } + + $uid = \App::$profile_uid; + + if(! feature_enabled($uid,'archives')) + return ''; + + if(! perm_is_allowed($uid,get_observer_hash(),'view_stream')) + return ''; + + $wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0); + $style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select'); + $showend = ((get_pconfig($uid,'system','archive_show_end_date')) ? true : false); + $mindate = get_pconfig($uid,'system','archive_mindate'); + $visible_years = get_pconfig($uid,'system','archive_visible_years'); + if(! $visible_years) + $visible_years = 5; + + $url = z_root() . '/' . \App::$cmd; + + $ret = list_post_dates($uid,$wall,$mindate); + + if(! count($ret)) + return ''; + + $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years; + $cutoff = ((array_key_exists($cutoff_year,$ret))? true : false); + + $o = replace_macros(get_markup_template('posted_date_widget.tpl'),array( + '$title' => t('Archives'), + '$size' => $visible_years, + '$cutoff_year' => $cutoff_year, + '$cutoff' => $cutoff, + '$url' => $url, + '$style' => $style, + '$showend' => $showend, + '$dates' => $ret + )); + return $o; + } +} + |