X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FContent%2FWidget.php;h=b9a75e4d2d8c5c1546f246175d55ff3b59171cb5;hb=ddd2c72be8e7245389f97d74dd847f5a20410936;hp=c74cd3ec31d1af8b1817d307bbb2cd1b1d6e636e;hpb=2fc7c9f064bfcfe8302886bc479c8ab5b4e06c8c;p=friendica.git diff --git a/src/Content/Widget.php b/src/Content/Widget.php index c74cd3ec31..b9a75e4d2d 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -1,6 +1,6 @@ DI::l10n()->t('Archives'), '$size' => $visible_years, '$cutoff_year' => $cutoff_year, @@ -510,7 +510,11 @@ class Widget '$url' => $url, '$dates' => $ret, '$showless' => DI::l10n()->t('show less'), - '$showmore' => DI::l10n()->t('show more') + '$showmore' => DI::l10n()->t('show more'), + '$onthisdate' => DI::l10n()->t('On this date'), + '$thisday' => $thisday, + '$nextday' => $nextday, + '$cutoffday' => $cutoffday ]); return $o; @@ -530,10 +534,66 @@ class Widget ['ref' => 'person', 'name' => DI::l10n()->t('Persons')], ['ref' => 'organisation', 'name' => DI::l10n()->t('Organisations')], ['ref' => 'news', 'name' => DI::l10n()->t('News')], - ['ref' => 'community', 'name' => DI::l10n()->t('Forums')], + ['ref' => 'community', 'name' => DI::l10n()->t('Groups')], ]; - return self::filter('accounttype', DI::l10n()->t('Account Types'), '', - DI::l10n()->t('All'), $base, $accounts, $accounttype); + return self::filter( + 'accounttype', + DI::l10n()->t('Account Types'), + '', + DI::l10n()->t('All'), + $base, + $accounts, + $accounttype + ); + } + + /** + * Get a list of all channels + * + * @param string $base + * @param string $channelname + * @param integer $uid + * @return string + */ + public static function channels(string $base, string $channelname, int $uid): string + { + $channels = []; + + $enabled = DI::pConfig()->get($uid, 'system', 'enabled_timelines', []); + + foreach (DI::NetworkFactory()->getTimelines('') as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::ChannelFactory()->getTimelines($uid) as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::userDefinedChannel()->selectByUid($uid) as $channel) { + if (empty($enabled) || in_array($channel->code, $enabled)) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + } + + foreach (DI::CommunityFactory()->getTimelines(true) as $community) { + if (empty($enabled) || in_array($community->code, $enabled)) { + $channels[] = ['ref' => $community->code, 'name' => $community->label]; + } + } + + return self::filter( + 'channel', + DI::l10n()->t('Channels'), + '', + '', + $base, + $channels, + $channelname + ); } }