diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-15 20:56:12 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-29 11:50:52 +0200 |
commit | 6e101e458268c0f9b7bf461cea3c31c37b5e3791 (patch) | |
tree | 2a641a76607431a2661b0d3b6c46babbd34b6c0d /Zotlabs/Widget/Affinity.php | |
parent | f60309efa12be3b8d4f5b2c565ebdf7f051a987d (diff) | |
download | volse-hubzilla-6e101e458268c0f9b7bf461cea3c31c37b5e3791.tar.gz volse-hubzilla-6e101e458268c0f9b7bf461cea3c31c37b5e3791.tar.bz2 volse-hubzilla-6e101e458268c0f9b7bf461cea3c31c37b5e3791.zip |
widgets cont.
Diffstat (limited to 'Zotlabs/Widget/Affinity.php')
-rw-r--r-- | Zotlabs/Widget/Affinity.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Zotlabs/Widget/Affinity.php b/Zotlabs/Widget/Affinity.php new file mode 100644 index 000000000..439ba1f33 --- /dev/null +++ b/Zotlabs/Widget/Affinity.php @@ -0,0 +1,60 @@ +<?php + +namespace Zotlabs\Widget; + +class Affinity { + + function widget($arr) { + + if(! local_channel()) + return ''; + + // Get default cmin value from pconfig, but allow GET parameter to override + $cmin = intval(get_pconfig(local_channel(),'affinity','cmin')); + $cmin = (($cmin) ? $cmin : 0); + $cmin = ((x($_REQUEST,'cmin')) ? intval($_REQUEST['cmin']) : $cmin); + + // Get default cmax value from pconfig, but allow GET parameter to override + $cmax = intval(get_pconfig(local_channel(),'affinity','cmax')); + $cmax = (($cmax) ? $cmax : 99); + $cmax = ((x($_REQUEST,'cmax')) ? intval($_REQUEST['cmax']) : $cmax); + + + if(feature_enabled(local_channel(),'affinity')) { + + $labels = array( + t('Me'), + t('Family'), + t('Friends'), + t('Acquaintances'), + t('All') + ); + call_hooks('affinity_labels',$labels); + $label_str = ''; + + if($labels) { + foreach($labels as $l) { + if($label_str) { + $label_str .= ", '|'"; + $label_str .= ", '" . $l . "'"; + } + else + $label_str .= "'" . $l . "'"; + } + } + + $tpl = get_markup_template('main_slider.tpl'); + $x = replace_macros($tpl,array( + '$val' => $cmin . ',' . $cmax, + '$refresh' => t('Refresh'), + '$labels' => $label_str, + )); + + $arr = array('html' => $x); + call_hooks('main_slider',$arr); + return $arr['html']; + } + return ''; + } +} +
\ No newline at end of file |