streams/Zotlabs/Widget/Affinity.php

49 lines
1.2 KiB
PHP
Raw Normal View History

2017-03-16 03:56:12 +00:00
<?php
namespace Zotlabs\Widget;
use Zotlabs\Lib\Apps;
2017-03-16 03:56:12 +00:00
class Affinity {
function widget($arr) {
if(! local_channel())
return '';
$default_cmin = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0);
$default_cmax = ((Apps::system_app_installed(local_channel(),'Friend Zoom')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99);
$cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $default_cmin);
$cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $default_cmax);
2017-03-16 03:56:12 +00:00
if(Apps::system_app_installed(local_channel(),'Friend Zoom')) {
2017-03-16 03:56:12 +00:00
$labels = array(
2018-12-28 23:13:22 +00:00
0 => t('Me'),
20 => t('Family'),
40 => t('Friends'),
60 => t('Peers'),
80 => t('Connections'),
99 => t('All')
2017-03-16 03:56:12 +00:00
);
call_hooks('affinity_labels',$labels);
$tpl = get_markup_template('main_slider.tpl');
2018-12-28 23:13:22 +00:00
$x = replace_macros($tpl, [
'$cmin' => $cmin,
'$cmax' => $cmax,
'$lbl' => t('Friend zoom in/out'),
2017-03-16 03:56:12 +00:00
'$refresh' => t('Refresh'),
2018-12-28 23:13:22 +00:00
'$labels' => $labels,
]);
2017-03-16 03:56:12 +00:00
$arr = array('html' => $x);
call_hooks('main_slider',$arr);
return $arr['html'];
}
return '';
}
}