2017-03-16 03:56:12 +00:00
|
|
|
<?php
|
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
namespace Code\Widget;
|
2017-03-16 03:56:12 +00:00
|
|
|
|
2022-02-16 04:08:28 +00:00
|
|
|
use Code\Lib\Apps;
|
|
|
|
use Code\Extend\Hook;
|
|
|
|
use Code\Render\Theme;
|
2022-02-12 20:43:29 +00:00
|
|
|
|
2018-08-17 06:01:31 +00:00
|
|
|
|
2022-10-23 21:18:44 +00:00
|
|
|
class Affinity implements WidgetInterface
|
2021-12-02 23:02:31 +00:00
|
|
|
{
|
|
|
|
|
2022-10-23 21:18:44 +00:00
|
|
|
public function widget(array $arr): string
|
2021-12-02 23:02:31 +00:00
|
|
|
{
|
|
|
|
|
2021-12-03 03:01:39 +00:00
|
|
|
if (!local_channel()) {
|
2021-12-02 23:02:31 +00:00
|
|
|
return '';
|
2021-12-03 03:01:39 +00:00
|
|
|
}
|
2021-12-02 23:02:31 +00:00
|
|
|
|
|
|
|
$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);
|
|
|
|
|
|
|
|
|
|
|
|
if (Apps::system_app_installed(local_channel(), 'Friend Zoom')) {
|
|
|
|
$labels = array(
|
|
|
|
0 => t('Me'),
|
|
|
|
20 => t('Family'),
|
|
|
|
40 => t('Friends'),
|
|
|
|
60 => t('Peers'),
|
|
|
|
80 => t('Connections'),
|
|
|
|
99 => t('All')
|
|
|
|
);
|
2022-02-12 08:50:48 +00:00
|
|
|
Hook::call('affinity_labels', $labels);
|
2021-12-02 23:02:31 +00:00
|
|
|
|
2022-02-12 20:43:29 +00:00
|
|
|
$tpl = Theme::get_template('main_slider.tpl');
|
2021-12-02 23:02:31 +00:00
|
|
|
$x = replace_macros($tpl, [
|
|
|
|
'$cmin' => $cmin,
|
|
|
|
'$cmax' => $cmax,
|
|
|
|
'$lbl' => t('Friend zoom in/out'),
|
|
|
|
'$refresh' => t('Refresh'),
|
|
|
|
'$labels' => $labels,
|
|
|
|
]);
|
|
|
|
|
|
|
|
$arr = array('html' => $x);
|
2022-02-12 08:50:48 +00:00
|
|
|
Hook::call('main_slider', $arr);
|
2021-12-02 23:02:31 +00:00
|
|
|
return $arr['html'];
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
}
|
2017-03-16 03:56:12 +00:00
|
|
|
}
|